mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 12:37:48 +00:00
added a test to capture new usecase exposed by vacuum
Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -1724,7 +1724,7 @@ func TestLocateRefNode_CurrentPathKey_HttpLink(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Kind: yaml.ScalarNode,
|
Kind: yaml.ScalarNode,
|
||||||
Value: "http://cakes.com#/components/schemas/thing",
|
Value: "http://cakes.com/nice#/components/schemas/thing",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1739,6 +1739,32 @@ func TestLocateRefNode_CurrentPathKey_HttpLink(t *testing.T) {
|
|||||||
assert.NotNil(t, c)
|
assert.NotNil(t, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLocateRefNode_CurrentPathKey_HttpLink_Local(t *testing.T) {
|
||||||
|
|
||||||
|
no := yaml.Node{
|
||||||
|
Kind: yaml.MappingNode,
|
||||||
|
Content: []*yaml.Node{
|
||||||
|
{
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
Value: "$ref",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
Value: ".#/components/schemas/thing",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := context.WithValue(context.Background(), index.CurrentPathKey, "http://cakes.com/nice/rice#/components/schemas/thing")
|
||||||
|
|
||||||
|
idx := index.NewSpecIndexWithConfig(&no, index.CreateClosedAPIIndexConfig())
|
||||||
|
n, i, e, c := LocateRefNodeWithContext(ctx, &no, idx)
|
||||||
|
assert.Nil(t, n)
|
||||||
|
assert.NotNil(t, i)
|
||||||
|
assert.NotNil(t, e)
|
||||||
|
assert.NotNil(t, c)
|
||||||
|
}
|
||||||
|
|
||||||
func TestLocateRefNode_CurrentPathKey_HttpLink_RemoteCtx(t *testing.T) {
|
func TestLocateRefNode_CurrentPathKey_HttpLink_RemoteCtx(t *testing.T) {
|
||||||
|
|
||||||
no := yaml.Node{
|
no := yaml.Node{
|
||||||
|
|||||||
Reference in New Issue
Block a user