more ye olde time coverage for ye tests.

This commit is contained in:
quobix
2024-08-05 08:43:28 -04:00
parent 4a72248424
commit 527d3cdc81
3 changed files with 7 additions and 12 deletions

View File

@@ -89,15 +89,7 @@ func (ex *Example) Build(ctx context.Context, keyNode, root *yaml.Node, _ *index
expChildNodes := low.ExtractNodesRecursive(ctx, vn)
expChildNodes.Range(func(k, v interface{}) bool {
if arr, ko := v.([]*yaml.Node); ko {
if ext, ok := ex.Nodes.Load(k); ok {
if extArr, kk := ext.([]*yaml.Node); kk {
ex.Nodes.Store(k, append(extArr, arr...))
} else {
ex.Nodes.Store(k, arr)
}
} else {
ex.Nodes.Store(k, arr)
}
ex.Nodes.Store(k, arr)
}
return true
})

View File

@@ -727,9 +727,6 @@ func (s *Schema) Build(ctx context.Context, root *yaml.Node, idx *index.SpecInde
discriminator.AddNode(key.(int), g)
}
}
if n, ok := val.(*yaml.Node); ok {
discriminator.AddNode(key.(int), n)
}
return true
})
}

View File

@@ -50,6 +50,12 @@ variables:
low.GenerateHashString(s.Value))
assert.Equal(t, 1, orderedmap.Len(n.GetExtensions()))
// check nodes on variables
for k := n.Variables.Value.First(); k != nil; k = k.Next() {
assert.NotNil(t, k.Value().Value.GetKeyNode())
assert.NotNil(t, k.Value().Value.GetRootNode())
}
}
func TestServer_Build_NoVars(t *testing.T) {