mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
Added some more tests to bump coverage back up.
Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -1004,6 +1004,39 @@ one:
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractMap_NoLookupWithExtensions_UsingMerge(t *testing.T) {
|
||||
|
||||
yml := `components:`
|
||||
|
||||
var idxNode yaml.Node
|
||||
mErr := yaml.Unmarshal([]byte(yml), &idxNode)
|
||||
assert.NoError(t, mErr)
|
||||
idx := index.NewSpecIndex(&idxNode)
|
||||
|
||||
yml = `x-yeah: &yeah
|
||||
night: fun
|
||||
x-hey: you
|
||||
one:
|
||||
x-choo: choo
|
||||
<<: *yeah`
|
||||
|
||||
var cNode yaml.Node
|
||||
e := yaml.Unmarshal([]byte(yml), &cNode)
|
||||
assert.NoError(t, e)
|
||||
|
||||
things, err := ExtractMapNoLookupExtensions[*test_Good](cNode.Content[0], idx, true)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, things, 3)
|
||||
|
||||
for k, v := range things {
|
||||
if k.Value == "x-hey" || k.Value == "x-yeah" || k.Value == "night" || k.Value == "<<" {
|
||||
continue
|
||||
}
|
||||
assert.Equal(t, "one", k.Value)
|
||||
assert.Len(t, v.ValueNode.Content, 6)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractMap_NoLookupWithoutExtensions(t *testing.T) {
|
||||
|
||||
yml := `components:`
|
||||
|
||||
Reference in New Issue
Block a user