Fix tests

This commit is contained in:
Adria Navarro 2024-03-12 09:57:25 +01:00
parent cd0004ec3d
commit 26c98ea084
2 changed files with 12 additions and 7 deletions

View File

@ -319,12 +319,16 @@ describe("/api/global/groups", () => {
})
})
it("update should return 200", async () => {
it("update should return forbidden", async () => {
await config.withUser(builder, async () => {
await config.api.groups.updateGroupUsers(group._id!, {
await config.api.groups.updateGroupUsers(
group._id!,
{
add: [builder._id!],
remove: [],
})
},
{ expect: 403 }
)
})
})
})

View File

@ -47,14 +47,15 @@ export class GroupsAPI extends TestAPI {
updateGroupUsers = (
id: string,
body: { add: string[]; remove: string[] }
body: { add: string[]; remove: string[] },
{ expect } = { expect: 200 }
) => {
return this.request
.post(`/api/global/groups/${id}/users`)
.send(body)
.set(this.config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
.expect(expect)
}
fetch = ({ expect } = { expect: 200 }) => {