From 2fda1bb5d1ffe1794add639cf243d2c4d1539030 Mon Sep 17 00:00:00 2001 From: adrinr Date: Wed, 15 Mar 2023 08:26:56 +0100 Subject: [PATCH] Clean tests --- .../worker/src/api/routes/global/tests/scim/users.spec.ts | 6 +++--- packages/worker/src/tests/api/scim/users.ts | 6 ++++-- 2 files changed, 7 insertions(+), 5 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 5c7ddb0393..dea9f02886 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 @@ -85,7 +85,7 @@ describe("/api/global/scim/v2/users", () => { const getScimUsers = config.api.scimUsersAPI.get it("unauthorised calls are not allowed", async () => { - const response = await getScimUsers(undefined, { + const response = await getScimUsers({ setHeaders: false, expect: 403, }) @@ -95,7 +95,7 @@ describe("/api/global/scim/v2/users", () => { it("cannot be called when feature is disabled", async () => { mocks.licenses.useCloudFree() - const response = await getScimUsers(undefined, { expect: 400 }) + const response = await getScimUsers({ expect: 400 }) expect(response).toEqual(featureDisabledResponse) }) @@ -142,7 +142,7 @@ describe("/api/global/scim/v2/users", () => { }) it("fetches second page", async () => { - const response = await getScimUsers({ startIndex: 20 }) + const response = await getScimUsers({ params: { startIndex: 20 } }) expect(response).toEqual({ Resources: users.slice(20), diff --git a/packages/worker/src/tests/api/scim/users.ts b/packages/worker/src/tests/api/scim/users.ts index 69b1cf0fc4..a40fac6308 100644 --- a/packages/worker/src/tests/api/scim/users.ts +++ b/packages/worker/src/tests/api/scim/users.ts @@ -43,10 +43,12 @@ export class ScimUsersAPI extends TestAPI { } get = async ( - params?: { startIndex?: number; pageSize?: number }, - requestSettings?: Partial + requestSettings?: Partial & { + params?: { startIndex?: number; pageSize?: number } + } ) => { let url = `/api/global/scim/v2/users?` + const params = requestSettings?.params if (params?.pageSize) { url += `count=${params.pageSize}&` }