-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding first test for creating of new swagger file via the API
- Loading branch information
Dom Harrington
committed
Mar 7, 2018
1 parent
cfb683b
commit 866d0d1
Showing
5 changed files
with
139 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"cli": "rdme", | ||
"host": { | ||
"url": "http://readme.local:3000" | ||
"url": "http://dash.readme.local:3000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const nock = require('nock'); | ||
|
||
const utils = require('../utils'); | ||
const push = require('../lib/push'); | ||
|
||
const config = utils.config('test'); | ||
const apiKey = 'Xmw4bGctRVIQz7R7dQXqH9nQe5d0SPQs' | ||
|
||
describe('push action', () => { | ||
after(() => nock.cleanAll()); | ||
|
||
it('should POST to the swagger api if no id provided', (done) => { | ||
const mock = nock(config.host.url).post('/v1/api/swagger', (body) => { | ||
return true; | ||
return body.match('form-data; name=\"swagger\"'); | ||
}).basicAuth({ user: apiKey, pass: '' }).reply(201); | ||
|
||
push.run(config, { args: ['./test/fixtures/json/swagger.json'], opts: { token: apiKey } }, (err) => { | ||
if (err) return done(err); | ||
mock.done(); | ||
|
||
return done(); | ||
}); | ||
}); | ||
}); |