From 471e386578b8245288991d0aaaf30be226ece460 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Tue, 3 Oct 2017 16:19:41 +0100 Subject: [PATCH] feat: Update fury-adapter-swagger to 0.14 --- package.json | 2 +- test/integration/compile-swagger-test.coffee | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7cb1f44fb..e707df16a 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/test/integration/compile-swagger-test.coffee b/test/integration/compile-swagger-test.coffee index 076b6223d..aa663d832 100644 --- a/test/integration/compile-swagger-test.coffee +++ b/test/integration/compile-swagger-test.coffee @@ -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} @@ -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}" ) ) )