Test updates

This commit is contained in:
Rory Powell 2022-04-12 15:37:49 +01:00
parent d99f579bf6
commit a6107dc7f9
4 changed files with 15 additions and 15 deletions

View File

@ -7,7 +7,7 @@ describe("utils", () => {
it("should call platform logout", async () => { it("should call platform logout", async () => {
const ctx = structures.koa.newContext() const ctx = structures.koa.newContext()
await utils.platformLogout({ ctx, userId: "test" }) await utils.platformLogout({ ctx, userId: "test" })
expect(events.auth.logout.mock.calls.length).toBe(1) expect(events.auth.logout).toBeCalledTimes(1)
}) })
}) })
}) })

View File

@ -41,7 +41,7 @@ describe("/applications", () => {
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(res.body._id).toBeDefined() expect(res.body._id).toBeDefined()
expect(events.app.created.mock.calls.length).toBe(1) expect(events.app.created).toBeCalledTimes(1)
}) })
it("creates app from template", async () => { it("creates app from template", async () => {
@ -55,8 +55,8 @@ describe("/applications", () => {
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(res.body._id).toBeDefined() expect(res.body._id).toBeDefined()
expect(events.app.created.mock.calls.length).toBe(1) expect(events.app.created).toBeCalledTimes(1)
expect(events.app.templateImported.mock.calls.length).toBe(1) expect(events.app.templateImported).toBeCalledTimes(1)
}) })
@ -70,8 +70,8 @@ describe("/applications", () => {
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(res.body._id).toBeDefined() expect(res.body._id).toBeDefined()
expect(events.app.created.mock.calls.length).toBe(1) expect(events.app.created).toBeCalledTimes(1)
expect(events.app.fileImported.mock.calls.length).toBe(1) expect(events.app.fileImported).toBeCalledTimes(1)
}) })
it("should apply authorization to endpoint", async () => { it("should apply authorization to endpoint", async () => {
@ -135,7 +135,7 @@ describe("/applications", () => {
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(res.body.rev).toBeDefined() expect(res.body.rev).toBeDefined()
expect(events.app.updated.mock.calls.length).toBe(1) expect(events.app.updated).toBeCalledTimes(1)
}) })
}) })
@ -148,7 +148,7 @@ describe("/applications", () => {
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(events.app.deleted.mock.calls.length).toBe(1) expect(events.app.deleted).toBeCalledTimes(1)
}) })
it("should unpublish app", async () => { it("should unpublish app", async () => {
@ -159,7 +159,7 @@ describe("/applications", () => {
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(events.app.unpublished.mock.calls.length).toBe(1) expect(events.app.unpublished).toBeCalledTimes(1)
}) })
}) })
@ -171,7 +171,7 @@ describe("/applications", () => {
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(events.app.versionUpdated.mock.calls.length).toBe(1) expect(events.app.versionUpdated).toBeCalledTimes(1)
}) })
it("should be able to revert the app client library version", async () => { it("should be able to revert the app client library version", async () => {
// We need to first update the version so that we can then revert // We need to first update the version so that we can then revert
@ -185,7 +185,7 @@ describe("/applications", () => {
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect("Content-Type", /json/) .expect("Content-Type", /json/)
.expect(200) .expect(200)
expect(events.app.versionReverted.mock.calls.length).toBe(1) expect(events.app.versionReverted).toBeCalledTimes(1)
}) })
}) })

View File

@ -31,7 +31,7 @@ describe("/datasources", () => {
expect(res.body.datasource.name).toEqual("Test") expect(res.body.datasource.name).toEqual("Test")
expect(res.body.errors).toBeUndefined() expect(res.body.errors).toBeUndefined()
expect(events.datasource.created.mock.calls.length).toBe(1) expect(events.datasource.created).toBeCalledTimes(1)
}) })
}) })
@ -47,7 +47,7 @@ describe("/datasources", () => {
expect(res.body.datasource.name).toEqual("Updated Test") expect(res.body.datasource.name).toEqual("Updated Test")
expect(res.body.errors).toBeUndefined() expect(res.body.errors).toBeUndefined()
expect(events.datasource.updated.mock.calls.length).toBe(1) expect(events.datasource.updated).toBeCalledTimes(1)
}) })
describe("dynamic variables", () => { describe("dynamic variables", () => {
@ -164,7 +164,7 @@ describe("/datasources", () => {
.expect(200) .expect(200)
expect(res.body.length).toEqual(1) expect(res.body.length).toEqual(1)
expect(events.datasource.deleted.mock.calls.length).toBe(1) expect(events.datasource.deleted).toBeCalledTimes(1)
}) })
it("should apply authorization to endpoint", async () => { it("should apply authorization to endpoint", async () => {

View File

@ -41,7 +41,7 @@ describe("/api/global/auth", () => {
.post("/api/global/auth/logout") .post("/api/global/auth/logout")
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.expect(200) .expect(200)
expect(events.auth.logout.mock.calls.length).toBe(1) expect(events.auth.logout).toBeCalledTimes(1)
}) })
it("should be able to generate password reset email", async () => { it("should be able to generate password reset email", async () => {