From 2c157c0feb9bff48aa94137ca59b959b12476466 Mon Sep 17 00:00:00 2001 From: adrinr Date: Mon, 13 Mar 2023 15:28:01 +0100 Subject: [PATCH] Test persistation --- .../api/routes/global/tests/scim/users.spec.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/worker/src/api/routes/global/tests/scim/users.spec.ts b/packages/worker/src/api/routes/global/tests/scim/users.spec.ts index 80f174d46d..e32fb5cf1f 100644 --- a/packages/worker/src/api/routes/global/tests/scim/users.spec.ts +++ b/packages/worker/src/api/routes/global/tests/scim/users.spec.ts @@ -65,7 +65,7 @@ describe("/api/global/scim/v2/users", () => { }) describe("no users exist", () => { - it("a new user can be created", async () => { + it("a new user can be created and persisted", async () => { const userData = { externalId: structures.uuid(), email: structures.generator.email(), @@ -100,7 +100,7 @@ describe("/api/global/scim/v2/users", () => { const response = await config.api.scimUsersAPI.post({ body }) - expect(response).toEqual({ + const expectedScimUser = { schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"], id: expect.any(String), externalId: userData.externalId, @@ -123,7 +123,16 @@ describe("/api/global/scim/v2/users", () => { primary: true, }, ], - }) + } + expect(response).toEqual(expectedScimUser) + + const persistedUsers = await config.api.scimUsersAPI.get() + expect(persistedUsers).toEqual( + expect.objectContaining({ + totalResults: 1, + Resources: [expectedScimUser], + }) + ) }) }) })