Test persistation

This commit is contained in:
adrinr 2023-03-13 15:28:01 +01:00
parent 3e68e8ebe8
commit 2c157c0feb
1 changed files with 12 additions and 3 deletions

View File

@ -65,7 +65,7 @@ describe("/api/global/scim/v2/users", () => {
}) })
describe("no users exist", () => { describe("no users exist", () => {
it("a new user can be created", async () => { it("a new user can be created and persisted", async () => {
const userData = { const userData = {
externalId: structures.uuid(), externalId: structures.uuid(),
email: structures.generator.email(), email: structures.generator.email(),
@ -100,7 +100,7 @@ describe("/api/global/scim/v2/users", () => {
const response = await config.api.scimUsersAPI.post({ body }) const response = await config.api.scimUsersAPI.post({ body })
expect(response).toEqual({ const expectedScimUser = {
schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"], schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"],
id: expect.any(String), id: expect.any(String),
externalId: userData.externalId, externalId: userData.externalId,
@ -123,7 +123,16 @@ describe("/api/global/scim/v2/users", () => {
primary: true, primary: true,
}, },
], ],
}) }
expect(response).toEqual(expectedScimUser)
const persistedUsers = await config.api.scimUsersAPI.get()
expect(persistedUsers).toEqual(
expect.objectContaining({
totalResults: 1,
Resources: [expectedScimUser],
})
)
}) })
}) })
}) })