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/'],
|
||||
collectCoverage: true,
|
||||
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 adminPassword = 'password'
|
||||
const hostname = 'localhost'
|
||||
const port = 8081
|
||||
const baseURL = `http://${hostname}:${port}`
|
||||
let port = 0
|
||||
let baseURL = `http://localhost:${port}`
|
||||
|
||||
let auth
|
||||
let clientState
|
||||
@@ -62,17 +62,27 @@ describe('streamwall server', () => {
|
||||
onMessage,
|
||||
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) => {
|
||||
clientState.update({ auth: authState })
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
server.close()
|
||||
afterEach(async () => {
|
||||
for (const ws of sockets) {
|
||||
ws.close()
|
||||
}
|
||||
if (server) {
|
||||
await new Promise((resolve) => server.close(resolve))
|
||||
}
|
||||
})
|
||||
|
||||
function socket(options) {
|
||||
|
||||
Reference in New Issue
Block a user