fix: Restore user deletion through API, increase rate limit

This commit is contained in:
Tom Moor
2022-08-17 22:40:00 +02:00
parent 41d7cc26b5
commit 7113b5f604
2 changed files with 42 additions and 14 deletions

View File

@@ -328,7 +328,7 @@ describe("#users.delete", () => {
expect(res.status).toEqual(400);
});
it("should require correct code", async () => {
it("should require correct code when no id passed", async () => {
const user = await buildAdmin();
await buildUser({
teamId: user.teamId,
@@ -357,6 +357,20 @@ describe("#users.delete", () => {
expect(res.status).toEqual(200);
});
it("should allow deleting user account as admin", async () => {
const admin = await buildAdmin();
const user = await buildUser({
teamId: admin.teamId,
});
const res = await server.post("/api/users.delete", {
body: {
id: user.id,
token: admin.getJwtToken(),
},
});
expect(res.status).toEqual(200);
});
it("should require authentication", async () => {
const res = await server.post("/api/users.delete");
const body = await res.json();