-
Notifications
You must be signed in to change notification settings - Fork 24
/
hippie-swagger.test.js
43 lines (38 loc) · 1.1 KB
/
hippie-swagger.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var nock = require('nock')
describe('hippie-swagger', function () {
var options = { validateResponseSchema: false }
it('works with 3 arguments', function (done) {
hippie(app, swaggerSchema, options)
.get('/foos/{fooId}')
.pathParams({ fooId: data.firstFoo.id })
.end(function (err, res) {
expect(err).to.be.undefined()
done()
})
})
describe('2 arguments', function () {
it('app and swagger', function (done) {
hippie(app, swaggerSchema)
.get('/foos/{fooId}')
.pathParams({ fooId: data.firstFoo.id })
.end(function (err, res) {
expect(err).to.be.undefined()
done()
})
})
it('swagger and options', function (done) {
var HOST = 'http://localhost:3000'
var PATH = '/foos/' + data.firstFoo.id
nock(HOST)
.get(PATH)
.reply(200)
hippie(swaggerSchema, options)
.get(HOST + '/foos/{fooId}')
.pathParams({ fooId: data.firstFoo.id })
.end(function (err, res) {
expect(err).to.be.undefined()
done()
})
})
})
})