server now created on contruction, before views intantiated.. refactor view API

This commit is contained in:
Lloyd Brookes
2016-07-17 17:05:21 +01:00
parent f11cbee820
commit 9d3484fed6
6 changed files with 119 additions and 92 deletions

View File

@ -12,13 +12,13 @@ test('stack', function (t) {
port: 8100,
testMode: true
})
const server = ws.getServer(() => {
ws.server.on('listening', () => {
return request('http://localhost:8100/')
.then(c.checkResponse(t, 200, /1234512345/))
.then(server.close.bind(server))
.then(ws.server.close.bind(ws.server))
.catch(err => {
t.fail(err.message)
server.close()
ws.server.close()
})
})
})
@ -34,13 +34,13 @@ test('https', function (t) {
const url = require('url')
const reqOptions = url.parse('https://localhost:8100/')
reqOptions.rejectUnauthorized = false
const server = ws.getServer(() => {
ws.server.on('listening', () => {
return request(reqOptions)
.then(c.checkResponse(t, 200, /1234512345/))
.then(server.close.bind(server))
.then(ws.server.close.bind(ws.server))
.catch(err => {
t.fail(err.message)
server.close()
ws.server.close()
})
})
})