Skip to content

Commit

Permalink
housekeeping: add test against overzealous prefix-stripping in error …
Browse files Browse the repository at this point in the history
…paths (via swagger-api#1925)

* housekeeping: add failing test

* remove exclusive test method
  • Loading branch information
shockey authored Mar 20, 2019
1 parent 2b56425 commit 2f6f02b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/unit/plugins/validate-semantic/2and3/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,37 @@ describe("validation plugin - semantic - 2and3 paths", () => {
})

it("should return one error when no parameters are defined", function(){
const spec = {
swagger: "2.0",
info: {
title: "test",
version: "1.0.0"
},
paths: {
"/{12345instanceABCDE_instance_12345}": {
get: {
responses: {
"200": {
description: "ok"
}
}
}
}
}
}

return validateHelper(spec)
.then(system => {
const allErrors = system.errSelectors.allErrors().toJS()
const firstError = allErrors[0]
expect(allErrors.length).toEqual(1)
expect(firstError.message).toEqual( "Declared path parameter \"12345instanceABCDE_instance_12345\" needs to be defined as a path parameter at either the path or operation level")
expect(firstError.path).toEqual(["paths", "/{12345instanceABCDE_instance_12345}"])
})

})

it("should return a well-formed error when ", function(){
const spec = {
swagger: "2.0",
paths: {
Expand Down

0 comments on commit 2f6f02b

Please sign in to comment.