...
1 package schutils
2
3 import (
4 "testing"
5
6 _ "github.com/go-openapi/analysis/internal/antest"
7 "github.com/go-openapi/spec"
8 "github.com/stretchr/testify/assert"
9 )
10
11 func TestFlattenSchema_Save(t *testing.T) {
12 t.Parallel()
13
14 sp := &spec.Swagger{}
15 Save(sp, "theName", spec.StringProperty())
16 assert.Contains(t, sp.Definitions, "theName")
17
18 saveNilSchema := func() {
19 Save(sp, "ThisNilSchema", nil)
20 }
21 assert.NotPanics(t, saveNilSchema)
22 }
23
24 func TestFlattenSchema_Clone(t *testing.T) {
25 sch := spec.RefSchema("#/definitions/x")
26 assert.EqualValues(t, sch, Clone(sch))
27 }
28
View as plain text