diff --git a/lib/swagger-client.test.js b/lib/swagger-client.test.js index 1c9a5fd0..0fa8e5e2 100644 --- a/lib/swagger-client.test.js +++ b/lib/swagger-client.test.js @@ -6,8 +6,10 @@ const expect = require('chai').expect const nock = require('nock') const Client = require('./swagger-client').Client +const Request = require('./backends/request') const url = 'http://mock.kube.api' +const config = { url } describe('lib.swagger-client', () => { describe('.Client', () => { @@ -28,8 +30,8 @@ describe('lib.swagger-client', () => { }) it('creates a dynamically generated client', done => { - const config = { url } - const client = new Client({ config }) + const backend = new Request(config) + const client = new Client({ backend }) client.loadSpec() .then(() => { expect(client.api.get).is.a('function') @@ -59,8 +61,8 @@ describe('lib.swagger-client', () => { }) it('creates a dynamically generated client', (done) => { - const config = { url } - const client = new Client({ config }) + const backend = new Request(config) + const client = new Client({ backend }) client.loadSpec() .then(() => { expect(client.api.get).is.a('function') @@ -90,8 +92,8 @@ describe('lib.swagger-client', () => { }) it('returns an error message with the status code', (done) => { - const config = { url } - const client = new Client({ config }) + const backend = new Request(config) + const client = new Client({ backend }) client.loadSpec() .then(() => { const err = new Error('This test should have caused an error') @@ -124,8 +126,8 @@ describe('lib.swagger-client', () => { }) it('returns an error message with the status code', (done) => { - const config = { url } - const client = new Client({ config }) + const backend = new Request(config) + const client = new Client({ backend }) client.loadSpec() .then(() => { const err = new Error('This test should have caused an error') @@ -141,8 +143,8 @@ describe('lib.swagger-client', () => { describe('.constructor', () => { it('creates a dynamically generated client synchronously based on version', () => { - const options = { config: {}, version: '1.9' } - const client = new Client(options) + const backend = new Request(config) + const client = new Client({ backend, version: '1.9' }) expect(client.api.get).is.a('function') }) diff --git a/scripts/typings.js b/scripts/typings.js index 9902695b..a6a38299 100644 --- a/scripts/typings.js +++ b/scripts/typings.js @@ -83,7 +83,8 @@ function main (args) { } const interfaces = [] - const client = new Client({ spec, config: {} }) + const backend = {} + const client = new Client({ backend, spec }) walk(client, interfaces) const templateOptions = {