Bumping coverage

checking all the corners for cobwebs
This commit is contained in:
Dave Shanley
2022-11-20 10:52:09 -05:00
parent 26d3535e75
commit e1e91d0682
4 changed files with 61 additions and 2 deletions

View File

@@ -1130,6 +1130,36 @@ func TestExtractSchema_DoNothing(t *testing.T) {
}
func TestExtractSchema_AdditionalProperties_Ref(t *testing.T) {
yml := `components:
schemas:
Nothing:
type: int
Something:
additionalProperties:
cake:
$ref: '#/components/schemas/Nothing'`
var iNode yaml.Node
mErr := yaml.Unmarshal([]byte(yml), &iNode)
assert.NoError(t, mErr)
idx := index.NewSpecIndex(&iNode)
yml = `schema:
type: int
additionalProperties:
$ref: '#/components/schemas/Something'`
var idxNode yaml.Node
_ = yaml.Unmarshal([]byte(yml), &idxNode)
res, err := ExtractSchema(idxNode.Content[0], idx)
assert.NotNil(t, res.Value.Schema().AdditionalProperties.Value.(*SchemaProxy).Schema())
assert.Nil(t, err)
}
func TestExtractSchema_OneOfRef(t *testing.T) {
yml := `components: