ignoreCli option.. fixed tests.. removed .listen() and close().. refactor
This commit is contained in:
32
test/test.js
32
test/test.js
@ -9,16 +9,15 @@ test('stack', function (t) {
|
||||
t.plan(2)
|
||||
const ws = new LocalWebServer({
|
||||
stack: [ path.resolve(__dirname, 'test-middleware.js') ],
|
||||
port: 8100
|
||||
port: 8100,
|
||||
ignoreCli: true
|
||||
})
|
||||
const server = ws.getServer(() => {
|
||||
return request('http://localhost:8100/')
|
||||
.then(c.checkResponse(t, 200, /1234512345/))
|
||||
.then(server.close.bind(server))
|
||||
.catch(c.fail(t))
|
||||
})
|
||||
ws.listen()
|
||||
.then(() => {
|
||||
return request('http://localhost:8100/')
|
||||
.then(c.checkResponse(t, 200, /1234512345/))
|
||||
.then(ws.close.bind(ws))
|
||||
.catch(c.fail(t))
|
||||
})
|
||||
.catch(c.fail(t))
|
||||
})
|
||||
|
||||
test('https', function (t) {
|
||||
@ -26,13 +25,12 @@ test('https', function (t) {
|
||||
const ws = new LocalWebServer({
|
||||
stack: [ path.resolve(__dirname, 'test-middleware.js') ],
|
||||
https: true,
|
||||
port: 8100
|
||||
port: 8100,
|
||||
ignoreCli: true
|
||||
})
|
||||
const server = ws.getServer(() => {
|
||||
return request('https://localhost:8100/')
|
||||
.then(c.checkResponse(t, 200, /1234512345/))
|
||||
.then(server.close.bind(server))
|
||||
})
|
||||
ws.listen()
|
||||
.then(() => {
|
||||
return request('https://localhost:8100/')
|
||||
.then(c.checkResponse(t, 200, /1234512345/))
|
||||
.then(ws.close.bind(ws))
|
||||
})
|
||||
.catch(c.fail(t))
|
||||
})
|
||||
|
Reference in New Issue
Block a user