Add scim test
This commit is contained in:
parent
e74847585e
commit
3ba3b18c2d
|
@ -574,6 +574,38 @@ describe("scim", () => {
|
||||||
|
|
||||||
expect(events.user.updated).toHaveBeenCalledTimes(1)
|
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", () => {
|
describe("DELETE /api/global/scim/v2/users/:id", () => {
|
||||||
|
|
Loading…
Reference in New Issue