ignoreCli option.. fixed tests.. removed .listen() and close().. refactor

This commit is contained in:
Lloyd Brookes
2016-07-11 22:19:04 +01:00
parent 7bb45ab0ae
commit c71b2267b7
3 changed files with 75 additions and 74 deletions

View File

@ -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))
})