...
1 package spec
2
3 import (
4 "encoding/json"
5 "path/filepath"
6 "testing"
7
8 "github.com/stretchr/testify/require"
9 )
10
11 func TestLoader_Issue145(t *testing.T) {
12 t.Run("with ExpandSpec", func(t *testing.T) {
13 basePath := filepath.Join("fixtures", "bugs", "145", "Program Files (x86)", "AppName", "todos.json")
14 todosDoc, err := jsonDoc(basePath)
15 require.NoError(t, err)
16
17 spec := new(Swagger)
18 require.NoError(t, json.Unmarshal(todosDoc, spec))
19
20 require.NoError(t, ExpandSpec(spec, &ExpandOptions{RelativeBase: basePath}))
21 })
22
23 t.Run("with ExpandSchema", func(t *testing.T) {
24 basePath := filepath.Join("fixtures", "bugs", "145", "Program Files (x86)", "AppName", "ref.json")
25 schemaDoc, err := jsonDoc(basePath)
26 require.NoError(t, err)
27
28 sch := new(Schema)
29 require.NoError(t, json.Unmarshal(schemaDoc, sch))
30
31 require.NoError(t, ExpandSchema(sch, nil, nil))
32 })
33 }
34
View as plain text