mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 12:37:49 +00:00
A massive test update to bring everything inlne with the new Buildable signature.
All tests in index and datamodel now pass. The rolodex fixes all the things. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pb33f/libopenapi/datamodel/low"
|
||||
"github.com/pb33f/libopenapi/index"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -33,7 +34,7 @@ func TestCallback_Build_Success(t *testing.T) {
|
||||
err := low.BuildModel(rootNode.Content[0], &n)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = n.Build(nil, rootNode.Content[0], nil)
|
||||
err = n.Build(context.Background(), nil, rootNode.Content[0], nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Len(t, n.Expression.Value, 1)
|
||||
@@ -65,7 +66,7 @@ func TestCallback_Build_Error(t *testing.T) {
|
||||
err := low.BuildModel(rootNode.Content[0], &n)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = n.Build(nil, rootNode.Content[0], idx)
|
||||
err = n.Build(context.Background(), nil, rootNode.Content[0], idx)
|
||||
assert.Error(t, err)
|
||||
|
||||
}
|
||||
@@ -100,7 +101,7 @@ func TestCallback_Build_Using_InlineRef(t *testing.T) {
|
||||
err := low.BuildModel(rootNode.Content[0], &n)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = n.Build(nil, rootNode.Content[0], idx)
|
||||
err = n.Build(context.Background(), nil, rootNode.Content[0], idx)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, n.Expression.Value, 1)
|
||||
|
||||
@@ -128,7 +129,7 @@ x-weed: loved`
|
||||
|
||||
var n Callback
|
||||
_ = low.BuildModel(idxNode.Content[0], &n)
|
||||
_ = n.Build(nil, idxNode.Content[0], idx)
|
||||
_ = n.Build(context.Background(), nil, idxNode.Content[0], idx)
|
||||
|
||||
yml2 := `burgers:
|
||||
description: tasty!
|
||||
@@ -145,7 +146,7 @@ beer:
|
||||
|
||||
var n2 Callback
|
||||
_ = low.BuildModel(idxNode2.Content[0], &n2)
|
||||
_ = n2.Build(nil, idxNode2.Content[0], idx2)
|
||||
_ = n2.Build(context.Background(), nil, idxNode2.Content[0], idx2)
|
||||
|
||||
// hash
|
||||
assert.Equal(t, n.Hash(), n2.Hash())
|
||||
|
||||
Reference in New Issue
Block a user