-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
models_test.go
61 lines (47 loc) · 1.08 KB
/
models_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package docs
import (
"reflect"
"testing"
)
func TestUnitNew(t *testing.T) {
t.Parallel()
got := New()
want := OAS{
RegisteredRoutes: RegRoutes{},
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got %+v, but want %+v", got, want)
}
}
func TestUnitEDIsEmpty(t *testing.T) {
t.Parallel()
edNil := (*ExternalDocs)(nil)
if !edNil.isEmpty() {
t.Errorf("expected an empty external docs struct")
}
edEmpty := ExternalDocs{}
if !edEmpty.isEmpty() {
t.Error("expected an empty external docs struct")
}
edEmptyURL := ExternalDocs{
Description: "description",
}
if !edEmptyURL.isEmpty() && !isStrEmpty(string(edEmptyURL.URL)) {
t.Errorf("expected an empty URL")
}
edEmptyDesc := ExternalDocs{
URL: "description",
}
if !edEmptyDesc.isEmpty() && !isStrEmpty(edEmptyDesc.Description) {
t.Errorf("expected an empty Description")
}
ed := ExternalDocs{
Description: "to many to describe",
URL: "Gagarin URI",
}
if ed.isEmpty() &&
!isStrEmpty(ed.Description) &&
!isStrEmpty(string(ed.URL)) {
t.Errorf("expected complete ExternalDocs struct")
}
}