Add multifetch test
This commit is contained in:
parent
621c06eada
commit
e679cc3987
|
@ -71,10 +71,6 @@ describe("/api/global/scim/v2/users", () => {
|
|||
await config.afterAll()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
const featureDisabledResponse = {
|
||||
error: {
|
||||
code: "feature_disabled",
|
||||
|
@ -117,11 +113,41 @@ describe("/api/global/scim/v2/users", () => {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("multiple users exist", () => {
|
||||
const userCount = 30
|
||||
let users: ScimUserResponse[]
|
||||
|
||||
beforeEach(async () => {
|
||||
users = []
|
||||
|
||||
for (let i = 0; i < userCount; i++) {
|
||||
const body = createScimCreateUserRequest()
|
||||
users.push(await config.api.scimUsersAPI.post({ body }))
|
||||
}
|
||||
})
|
||||
|
||||
it("fetch full first page", async () => {
|
||||
const response = await getScimUsers()
|
||||
|
||||
expect(response).toEqual({
|
||||
Resources: expect.arrayContaining(users.splice(0, 20)),
|
||||
itemsPerPage: 20,
|
||||
schemas: ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
|
||||
startIndex: 1,
|
||||
totalResults: userCount,
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /api/global/scim/v2/users", () => {
|
||||
const postScimUser = config.api.scimUsersAPI.post
|
||||
|
||||
beforeAll(async () => {
|
||||
await config.useNewTenant()
|
||||
})
|
||||
|
||||
it("unauthorised calls are not allowed", async () => {
|
||||
const response = await postScimUser(
|
||||
{ body: {} as any },
|
||||
|
|
|
@ -53,6 +53,12 @@ class TestConfiguration {
|
|||
this.api = new API(this)
|
||||
}
|
||||
|
||||
async useNewTenant() {
|
||||
this.tenantId = structures.tenant.id()
|
||||
|
||||
await this.beforeAll()
|
||||
}
|
||||
|
||||
getRequest() {
|
||||
return this.request
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue