Test extra cases
This commit is contained in:
parent
de716ba869
commit
e222381a6c
|
@ -1,6 +1,6 @@
|
||||||
import { ScimResource, ScimMeta, ScimPatchOperation } from "scim-patch"
|
import { ScimResource, ScimMeta, ScimPatchOperation } from "scim-patch"
|
||||||
|
|
||||||
type BooleanString = boolean | "True" | "False"
|
type BooleanString = boolean | "True" | "true" | "False" | "false"
|
||||||
|
|
||||||
export interface ScimUserResponse extends ScimResource {
|
export interface ScimUserResponse extends ScimResource {
|
||||||
schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"]
|
schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"]
|
||||||
|
|
|
@ -396,23 +396,26 @@ describe("/api/global/scim/v2/users", () => {
|
||||||
expect(persistedUser).toEqual(expectedScimUser)
|
expect(persistedUser).toEqual(expectedScimUser)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can deactive an active user", async () => {
|
it.each([false, "false", "False"])(
|
||||||
const body: ScimUpdateRequest = {
|
"can deactive an active user (sending %s)",
|
||||||
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
|
async activeValue => {
|
||||||
Operations: [{ op: "Replace", path: "active", value: "False" }],
|
const body: ScimUpdateRequest = {
|
||||||
|
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
|
||||||
|
Operations: [{ op: "Replace", path: "active", value: activeValue }],
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await patchScimUser({ id: user.id, body })
|
||||||
|
|
||||||
|
const expectedScimUser: ScimUserResponse = {
|
||||||
|
...user,
|
||||||
|
active: false,
|
||||||
|
}
|
||||||
|
expect(response).toEqual(expectedScimUser)
|
||||||
|
|
||||||
|
const persistedUser = await config.api.scimUsersAPI.find(user.id)
|
||||||
|
expect(persistedUser).toEqual(expectedScimUser)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
const response = await patchScimUser({ id: user.id, body })
|
|
||||||
|
|
||||||
const expectedScimUser: ScimUserResponse = {
|
|
||||||
...user,
|
|
||||||
active: false,
|
|
||||||
}
|
|
||||||
expect(response).toEqual(expectedScimUser)
|
|
||||||
|
|
||||||
const persistedUser = await config.api.scimUsersAPI.find(user.id)
|
|
||||||
expect(persistedUser).toEqual(expectedScimUser)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("supports updating unmapped fields", async () => {
|
it("supports updating unmapped fields", async () => {
|
||||||
const body: ScimUpdateRequest = {
|
const body: ScimUpdateRequest = {
|
||||||
|
|
Loading…
Reference in New Issue