-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
frameworks_test.go
36 lines (31 loc) · 1.02 KB
/
frameworks_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package megos
import (
"reflect"
"testing"
)
func TestGetFrameworkByPrefix_WithFramework(t *testing.T) {
prefix := "Test Framework three"
frameworks := []Framework{
{ID: "Framework1", Name: "Test Framework one"},
{ID: "Framework2", Name: "Test Framework two"},
{ID: "Framework3", Name: "Test Framework three is really cool"},
}
if f, err := client.GetFrameworkByPrefix(frameworks, prefix); !reflect.DeepEqual(f, &frameworks[2]) {
t.Errorf("Framework is not the one as expected (%s). Expected % v, got % v", err, &frameworks[2], f)
}
}
func TestGetFrameworkByPrefix_WithoutFramework(t *testing.T) {
prefix := "test"
frameworks := []Framework{
{ID: "Framework1", Name: "Test Framework one"},
{ID: "Framework2", Name: "Test Framework two"},
{ID: "Framework3IsReallyCool", Name: "Test Framework three"},
}
f, err := client.GetFrameworkByPrefix(frameworks, prefix)
if f != nil {
t.Errorf("Framework is not nil. Expected nil, got % v", f)
}
if err == nil {
t.Errorf("err is nil. Expected a string, got %s", err)
}
}