Skip to content

Commit 65f794d

Browse files
committed
add test for invalid path handling to prevent stack overflows
1 parent 5ede6d1 commit 65f794d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test-harness/tests/specs/DocumentSpec.cfc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ component extends="BaseOpenAPISpec"{
6464
});
6565

6666
} );
67+
68+
describe( "Core functionality tests", function(){
69+
70+
it( "Tests that an attempt to locate an invalid path with return a $ref object", function(){
71+
var DocumentObject = getInstance( "OpenAPIDocument@SwaggerSDK" ).init( VARIABLES.testDocument );
72+
73+
expect( DocumentObject )
74+
.toBeComponent()
75+
.toHaveKey( "getDocument" );
76+
77+
var invalidPath = DocumentObject.locate( "foo.bar" );
78+
expect( invalidPath ).toBeStruct().toHaveKey( "$ref" );
79+
expect( invalidPath[ "$ref" ] ).toBe( "##/foo/bar" );
80+
81+
})
82+
})
6783
}
6884

6985
}

0 commit comments

Comments
 (0)