API - allow search of a group using its name (#6066)

This commit is contained in:
Agnès Haasser
2023-10-28 17:36:16 +02:00
committed by GitHub
parent 7380f6d5ae
commit 057d8a7f3b
3 changed files with 52 additions and 5 deletions

View File

@@ -258,6 +258,39 @@ describe("#groups.list", () => {
.includes(anotherUser.id)
).toBe(true);
});
it("should allow to find a group by its name", async () => {
const user = await buildUser();
const group = await buildGroup({
teamId: user.teamId,
});
const anotherGroup = await buildGroup({
teamId: user.teamId,
});
const unfilteredRes = await server.post("/api/groups.list", {
body: {
token: user.getJwtToken(),
},
});
const body = await unfilteredRes.json();
expect(unfilteredRes.status).toEqual(200);
expect(body.data.groups.length).toEqual(2);
expect(body.data.groups[0].id).toEqual(anotherGroup.id);
expect(body.data.groups[1].id).toEqual(group.id);
const anotherRes = await server.post("/api/groups.list", {
body: {
name: group.name,
token: user.getJwtToken(),
},
});
const anotherBody = await anotherRes.json();
expect(anotherRes.status).toEqual(200);
expect(anotherBody.data.groups.length).toEqual(1);
expect(anotherBody.data.groups[0].id).toEqual(group.id);
});
});
describe("#groups.info", () => {