Add create test
This commit is contained in:
parent
e6ff0a44fb
commit
7840470d83
|
@ -120,3 +120,5 @@ jest.spyOn(events.view, "calculationDeleted")
|
|||
jest.spyOn(events.plugin, "init")
|
||||
jest.spyOn(events.plugin, "imported")
|
||||
jest.spyOn(events.plugin, "deleted")
|
||||
|
||||
jest.spyOn(events.scim, "SCIMUserCreated")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import tk from "timekeeper"
|
||||
import _ from "lodash"
|
||||
import { events } from "@budibase/backend-core"
|
||||
import { mocks, structures } from "@budibase/backend-core/tests"
|
||||
import { ScimUpdateRequest, ScimUserResponse } from "@budibase/types"
|
||||
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(),
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue