Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #108 from apiaryio/kylef/swagger-0.14
Browse files Browse the repository at this point in the history
Update fury-adapter-swagger to 0.14
  • Loading branch information
Michal Holasek authored Oct 18, 2017
2 parents b457d8b + 471e386 commit 1ccd317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"clone": "^2.1.1",
"fury": "^3.0.0-beta.4",
"fury-adapter-apib-parser": "^0.9.0",
"fury-adapter-swagger": "^0.13.3",
"fury-adapter-swagger": "^0.14.2",
"uri-template": "^1.0.0"
},
"devDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions test/integration/compile-swagger-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('compile() · Swagger', ->
compilationResult = undefined
filename = 'apiDescription.json'
detectTransactionExampleNumbers = sinon.spy(require('../../src/detect-transaction-example-numbers'))
expectedStatusCodes = [200, 400, 500]
expectedStatusCodes = [200, 200, 400, 400, 500, 500]

beforeEach((done) ->
stubs = {'./detect-transaction-example-numbers': detectTransactionExampleNumbers}
Expand All @@ -132,19 +132,23 @@ describe('compile() · Swagger', ->
it('is compiled with no errors', ->
assert.deepEqual(compilationResult.errors, [])
)

for statusCode, i in expectedStatusCodes
do (statusCode, i) ->
context("origin of transaction ##{i + 1}", ->
it('uses URI as resource name', ->
assert.equal(compilationResult.transactions[i].origin.resourceName, '/honey')
)

it('uses method as action name', ->
assert.equal(compilationResult.transactions[i].origin.actionName, 'GET')
)

it('uses status code and response\'s Content-Type as example name', ->
contentType = if i % 2 then 'application/json' else 'application/xml'
assert.equal(
compilationResult.transactions[i].origin.exampleName,
"#{statusCode} > application/json"
"#{statusCode} > #{contentType}"
)
)
)
Expand Down

0 comments on commit 1ccd317

Please sign in to comment.