mirror of
https://github.com/streamwall/streamwall.git
synced 2025-12-06 01:45:37 -05:00
Fix failing tests
This commit is contained in:
@@ -17,5 +17,5 @@ module.exports = {
|
|||||||
coveragePathIgnorePatterns: ['/node_modules/'],
|
coveragePathIgnorePatterns: ['/node_modules/'],
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
coverageReporters: ['json', 'lcov', 'text', 'clover'],
|
coverageReporters: ['json', 'lcov', 'text', 'clover'],
|
||||||
testEnvironment: 'jsdom'
|
testEnvironment: 'node'
|
||||||
};
|
};
|
||||||
11701
package-lock.json
generated
11701
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -20,8 +20,8 @@ describe('streamwall server', () => {
|
|||||||
const adminUsername = 'admin'
|
const adminUsername = 'admin'
|
||||||
const adminPassword = 'password'
|
const adminPassword = 'password'
|
||||||
const hostname = 'localhost'
|
const hostname = 'localhost'
|
||||||
const port = 8081
|
let port = 0
|
||||||
const baseURL = `http://${hostname}:${port}`
|
let baseURL = `http://localhost:${port}`
|
||||||
|
|
||||||
let auth
|
let auth
|
||||||
let clientState
|
let clientState
|
||||||
@@ -62,17 +62,27 @@ describe('streamwall server', () => {
|
|||||||
onMessage,
|
onMessage,
|
||||||
stateDoc,
|
stateDoc,
|
||||||
}))
|
}))
|
||||||
request = supertest(server)
|
|
||||||
|
// Wait for the server to actually start so we can read its actual port
|
||||||
|
const address = server.address()
|
||||||
|
port = address.port
|
||||||
|
|
||||||
|
// Now you can build the real baseURL for supertest
|
||||||
|
baseURL = `http://localhost:${port}`
|
||||||
|
request = supertest(baseURL)
|
||||||
|
|
||||||
auth.on('state', (authState) => {
|
auth.on('state', (authState) => {
|
||||||
clientState.update({ auth: authState })
|
clientState.update({ auth: authState })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(async () => {
|
||||||
server.close()
|
|
||||||
for (const ws of sockets) {
|
for (const ws of sockets) {
|
||||||
ws.close()
|
ws.close()
|
||||||
}
|
}
|
||||||
|
if (server) {
|
||||||
|
await new Promise((resolve) => server.close(resolve))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function socket(options) {
|
function socket(options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user