mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 04:20:11 +00:00
bumped coverage
This commit is contained in:
@@ -76,7 +76,7 @@ func CreateSchemaProxyRef(ref string) *SchemaProxy {
|
||||
// If there is a problem building the Schema, then this method will return nil. Use GetBuildError to gain access
|
||||
// to that building error.
|
||||
func (sp *SchemaProxy) Schema() *Schema {
|
||||
if sp == nil {
|
||||
if sp == nil || sp.lock == nil {
|
||||
return nil
|
||||
}
|
||||
sp.lock.Lock()
|
||||
|
||||
@@ -60,6 +60,11 @@ func TestSchemaProxy_MarshalYAML(t *testing.T) {
|
||||
assert.Equal(t, "$ref: '#/components/schemas/nice'", strings.TrimSpace(string(rend)))
|
||||
}
|
||||
|
||||
func TestCreateSchemaProxy_Fail(t *testing.T) {
|
||||
proxy := &SchemaProxy{}
|
||||
assert.Nil(t, proxy.Schema())
|
||||
}
|
||||
|
||||
func TestCreateSchemaProxy(t *testing.T) {
|
||||
sp := CreateSchemaProxy(&Schema{Description: "iAmASchema"})
|
||||
assert.Equal(t, "iAmASchema", sp.rendered.Description)
|
||||
|
||||
@@ -59,6 +59,13 @@ definitions:
|
||||
assert.Nil(t, v2Doc)
|
||||
}
|
||||
|
||||
func TestLoadDocument_WrongDoc(t *testing.T) {
|
||||
yml := `IAmNotAnOpenAPI: 3.1.0`
|
||||
doc, err := NewDocument([]byte(yml))
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, doc)
|
||||
}
|
||||
|
||||
func TestLoadDocument_Simple_V3_Error(t *testing.T) {
|
||||
yml := `openapi: 3.0.1`
|
||||
doc, err := NewDocument([]byte(yml))
|
||||
|
||||
Reference in New Issue
Block a user