Fix tests
This commit is contained in:
parent
6396548064
commit
122db55dce
|
@ -399,53 +399,19 @@ describe("scim", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it.each([false, "false", "False"])(
|
it.each([false, "false", "False"])(
|
||||||
"can deactive an active user (sending %s)",
|
"deactivating an active user (sending %s) will delete it",
|
||||||
async activeValue => {
|
async activeValue => {
|
||||||
const body: ScimUpdateRequest = {
|
const body: ScimUpdateRequest = {
|
||||||
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
|
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
|
||||||
Operations: [{ op: "Replace", path: "active", value: activeValue }],
|
Operations: [{ op: "Replace", path: "active", value: activeValue }],
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await patchScimUser({ id: user.id, body })
|
await patchScimUser(
|
||||||
|
{ id: user.id, body },
|
||||||
const expectedScimUser: ScimUserResponse = {
|
{ expect: 204, skipContentTypeCheck: true }
|
||||||
...user,
|
|
||||||
active: false,
|
|
||||||
}
|
|
||||||
expect(response).toEqual(expectedScimUser)
|
|
||||||
|
|
||||||
const persistedUser = await config.api.scimUsersAPI.find(user.id)
|
|
||||||
expect(persistedUser).toEqual(expectedScimUser)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
it.each([true, "true", "True"])(
|
await config.api.scimUsersAPI.find(user.id, { expect: 404 })
|
||||||
"can activate an inactive user (sending %s)",
|
|
||||||
async activeValue => {
|
|
||||||
// Deactivate user
|
|
||||||
await patchScimUser({
|
|
||||||
id: user.id,
|
|
||||||
body: {
|
|
||||||
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
|
|
||||||
Operations: [{ op: "Replace", path: "active", value: true }],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
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: true,
|
|
||||||
}
|
|
||||||
expect(response).toEqual(expectedScimUser)
|
|
||||||
|
|
||||||
const persistedUser = await config.api.scimUsersAPI.find(user.id)
|
|
||||||
expect(persistedUser).toEqual(expectedScimUser)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { TestAPI } from "../base"
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
expect: 200,
|
expect: 200,
|
||||||
setHeaders: true,
|
setHeaders: true,
|
||||||
|
skipContentTypeCheck: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RequestSettings = typeof defaultConfig
|
export type RequestSettings = typeof defaultConfig
|
||||||
|
@ -27,7 +28,7 @@ export abstract class ScimTestAPI extends TestAPI {
|
||||||
"application/scim+json; charset=utf-8"
|
"application/scim+json; charset=utf-8"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (method !== "delete") {
|
if (method !== "delete" && !requestSettings?.skipContentTypeCheck) {
|
||||||
request = request.expect("Content-Type", /json/)
|
request = request.expect("Content-Type", /json/)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue