fix: Server error if non-array passed to users.invite

This commit is contained in:
Tom Moor
2021-06-07 20:28:28 -07:00
parent 4a8d357084
commit d8ca9c6111
3 changed files with 19 additions and 1 deletions

View File

@ -167,6 +167,17 @@ describe("#users.invite", () => {
expect(body.data.sent.length).toEqual(1);
});
it("should require invites to be an array", async () => {
const user = await buildUser();
const res = await server.post("/api/users.invite", {
body: {
token: user.getJwtToken(),
invites: { email: "test@example.com", name: "Test", guest: false },
},
});
expect(res.status).toEqual(400);
});
it("should require admin", async () => {
const user = await buildUser();
const res = await server.post("/api/users.invite", {