Add role parameter to users.list endpoint (#6754)

This commit is contained in:
Tom Moor
2024-04-02 06:00:12 -06:00
committed by GitHub
parent d2d3adefe6
commit 365f4c4b1f
3 changed files with 39 additions and 1 deletions

View File

@@ -40,6 +40,26 @@ describe("#users.list", () => {
expect(body.data[0].id).toEqual(user.id);
});
it("should allow filtering by role", async () => {
const user = await buildUser({
name: "Tester",
});
const admin = await buildAdmin({
name: "Admin",
teamId: user.teamId,
});
const res = await server.post("/api/users.list", {
body: {
role: UserRole.Admin,
token: user.getJwtToken(),
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.length).toEqual(1);
expect(body.data[0].id).toEqual(admin.id);
});
it("should allow filtering to suspended users", async () => {
const admin = await buildAdmin();
await buildUser({