Clean tests

This commit is contained in:
adrinr 2023-03-15 08:26:56 +01:00
parent 86d848458e
commit 2fda1bb5d1
2 changed files with 7 additions and 5 deletions

View File

@ -85,7 +85,7 @@ describe("/api/global/scim/v2/users", () => {
const getScimUsers = config.api.scimUsersAPI.get const getScimUsers = config.api.scimUsersAPI.get
it("unauthorised calls are not allowed", async () => { it("unauthorised calls are not allowed", async () => {
const response = await getScimUsers(undefined, { const response = await getScimUsers({
setHeaders: false, setHeaders: false,
expect: 403, expect: 403,
}) })
@ -95,7 +95,7 @@ describe("/api/global/scim/v2/users", () => {
it("cannot be called when feature is disabled", async () => { it("cannot be called when feature is disabled", async () => {
mocks.licenses.useCloudFree() mocks.licenses.useCloudFree()
const response = await getScimUsers(undefined, { expect: 400 }) const response = await getScimUsers({ expect: 400 })
expect(response).toEqual(featureDisabledResponse) expect(response).toEqual(featureDisabledResponse)
}) })
@ -142,7 +142,7 @@ describe("/api/global/scim/v2/users", () => {
}) })
it("fetches second page", async () => { it("fetches second page", async () => {
const response = await getScimUsers({ startIndex: 20 }) const response = await getScimUsers({ params: { startIndex: 20 } })
expect(response).toEqual({ expect(response).toEqual({
Resources: users.slice(20), Resources: users.slice(20),

View File

@ -43,10 +43,12 @@ export class ScimUsersAPI extends TestAPI {
} }
get = async ( get = async (
params?: { startIndex?: number; pageSize?: number }, requestSettings?: Partial<RequestSettings> & {
requestSettings?: Partial<RequestSettings> params?: { startIndex?: number; pageSize?: number }
}
) => { ) => {
let url = `/api/global/scim/v2/users?` let url = `/api/global/scim/v2/users?`
const params = requestSettings?.params
if (params?.pageSize) { if (params?.pageSize) {
url += `count=${params.pageSize}&` url += `count=${params.pageSize}&`
} }