Add create test

This commit is contained in:
adrinr 2023-03-24 14:25:35 +00:00
parent e6ff0a44fb
commit 7840470d83
2 changed files with 16 additions and 0 deletions

View File

@ -120,3 +120,5 @@ jest.spyOn(events.view, "calculationDeleted")
jest.spyOn(events.plugin, "init") jest.spyOn(events.plugin, "init")
jest.spyOn(events.plugin, "imported") jest.spyOn(events.plugin, "imported")
jest.spyOn(events.plugin, "deleted") jest.spyOn(events.plugin, "deleted")
jest.spyOn(events.scim, "SCIMUserCreated")

View File

@ -1,5 +1,6 @@
import tk from "timekeeper" import tk from "timekeeper"
import _ from "lodash" import _ from "lodash"
import { events } from "@budibase/backend-core"
import { mocks, structures } from "@budibase/backend-core/tests" import { mocks, structures } from "@budibase/backend-core/tests"
import { ScimUpdateRequest, ScimUserResponse } from "@budibase/types" import { ScimUpdateRequest, ScimUserResponse } from "@budibase/types"
import { TestConfiguration } from "../../../../../tests" import { TestConfiguration } from "../../../../../tests"
@ -236,6 +237,19 @@ describe("/api/global/scim/v2/users", () => {
}) })
) )
}) })
it("an event is dispatched", async () => {
const email = structures.email()
const body = createScimCreateUserRequest({ email })
await postScimUser({ body })
expect(events.scim.SCIMUserCreated).toBeCalledTimes(1)
expect(events.scim.SCIMUserCreated).toBeCalledWith({
email,
timestamp: mockedTime.toISOString(),
})
})
}) })
}) })