Test coverage for v3 model is now at 100%

This should be very easy to duplicate to 2.0 and 3.1, now extraction code needs testing.

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2022-08-27 12:48:58 -04:00
parent c34c4f668c
commit 51e1f62b04
19 changed files with 634 additions and 669 deletions

View File

@@ -188,8 +188,8 @@ func TestCreateDocument_Paths(t *testing.T) {
assert.Len(t, burgerId.Value.Get.Value.Parameters.Value, 2)
param := burgerId.Value.Get.Value.Parameters.Value[1]
assert.Equal(t, "burgerHeader", param.Value.Name.Value)
prop := param.Value.Schema.Value.Schema().FindProperty("burgerTheme")
assert.Equal(t, "something about a theme?", prop.Value.Schema().Description.Value)
prop := param.Value.Schema.Value.Schema().FindProperty("burgerTheme").Value
assert.Equal(t, "something about a theme?", prop.Schema().Description.Value)
assert.Equal(t, "big-mac", param.Value.Example.Value)
// check content
@@ -502,6 +502,19 @@ func TestCreateDocument_Components_Error(t *testing.T) {
assert.Error(t, ob.GetBuildError())
}
func TestCreateDocument_Components_Error_Extract(t *testing.T) {
yml := `components:
parameters:
bork:
$ref: #bork`
info, _ := datamodel.ExtractSpecInfo([]byte(yml))
var err []error
doc, err = CreateDocument(info)
assert.Len(t, err, 1)
}
func TestCreateDocument_Paths_Errors(t *testing.T) {
yml := `paths:
/p: