Fixing test cases.

This commit is contained in:
Michael Drury 2020-10-28 22:37:58 +00:00
parent 56f1170ae9
commit 66e3e3b7a4
9 changed files with 23 additions and 18 deletions

View File

@ -25,8 +25,8 @@ describe("/accesslevels", () => {
({ request, server } = await supertest())
});
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
beforeEach(async () => {

View File

@ -18,8 +18,8 @@ describe("/applications", () => {
await clearApplications(request)
})
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
describe("create", () => {

View File

@ -53,8 +53,8 @@ describe("/automations", () => {
if (automation) await destroyDocument(automation.id)
})
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
const createAutomation = async () => {

View File

@ -15,12 +15,12 @@ const TEST_CLIENT_ID = "test-client-id"
exports.TEST_CLIENT_ID = TEST_CLIENT_ID
exports.supertest = async () => {
let request
let app
let server
env.PORT = 4002
app = require("../../../app")
server = require("../../../app")
request = supertest(app)
return { request, app }
request = supertest(server)
return { request, server }
}
exports.defaultHeaders = instanceId => {

View File

@ -14,8 +14,8 @@ describe("/instances", () => {
TEST_APP_ID = (await createApplication(request))._id
});
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
describe("create", () => {

View File

@ -18,8 +18,8 @@ describe("/rows", () => {
});
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
beforeEach(async () => {

View File

@ -17,8 +17,8 @@ describe("/tables", () => {
({ request, server } = await supertest())
});
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
beforeEach(async () => {

View File

@ -26,6 +26,11 @@ describe("/users", () => {
instanceId = app.instances[0]._id
});
afterAll(() => {
server.close()
server.destroy()
})
describe("fetch", () => {
it("returns a list of users from an instance db", async () => {
await createUser(request, instanceId, "brenda", "brendas_password")

View File

@ -42,8 +42,8 @@ describe("/views", () => {
instanceId = app.instances[0]._id
})
afterAll(done => {
server.close(done)
afterAll(() => {
server.close()
})
describe("create", () => {