mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 12:37:49 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user