Add scim test

This commit is contained in:
Adria Navarro 2024-07-03 16:57:22 +02:00
parent e74847585e
commit 3ba3b18c2d
1 changed files with 32 additions and 0 deletions

View File

@ -574,6 +574,38 @@ describe("scim", () => {
expect(events.user.updated).toHaveBeenCalledTimes(1)
})
it("an existing user's email can be updated", async () => {
const newEmail = structures.generator.email()
const body: ScimUpdateRequest = {
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
Operations: [
{
op: "Replace",
path: 'emails[type eq "work"].value',
value: newEmail,
},
],
}
const response = await patchScimUser({ id: user.id, body })
const expectedScimUser: ScimUserResponse = {
...user,
emails: [
{
value: newEmail,
type: "work",
primary: true,
},
],
}
expect(response).toEqual(expectedScimUser)
const persistedUser = await config.api.scimUsersAPI.find(user.id)
expect(persistedUser).toEqual(expectedScimUser)
})
})
describe("DELETE /api/global/scim/v2/users/:id", () => {