Add extra test

This commit is contained in:
Adria Navarro 2024-02-22 13:55:59 +01:00
parent 8e77365c19
commit ea615f420c
2 changed files with 28 additions and 0 deletions

View File

@ -654,6 +654,26 @@ describe("scim", () => {
totalResults: groupCount,
})
})
it("can fetch groups even if internal groups exist", async () => {
mocks.licenses.useGroups()
await config.api.groups.saveGroup(structures.userGroups.userGroup())
await config.api.groups.saveGroup(structures.userGroups.userGroup())
const response = await getScimGroups()
expect(response).toEqual({
Resources: expect.arrayContaining(groups),
itemsPerPage: 25,
schemas: ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
startIndex: 1,
totalResults: groupCount,
})
expect((await config.api.groups.fetch()).body.data).toHaveLength(
25 + 2 // scim groups + internal groups
)
})
})
})

View File

@ -53,4 +53,12 @@ export class GroupsAPI extends TestAPI {
.expect("Content-Type", /json/)
.expect(200)
}
fetch = ({ expect } = { expect: 200 }) => {
return this.request
.get(`/api/global/groups`)
.set(this.config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(expect)
}
}