mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
Precision pass on auth and resource analysis (#63)
This commit is contained in:
parent
064801a3a4
commit
c7c5e0f3a1
62 changed files with 4248 additions and 138 deletions
|
|
@ -0,0 +1,24 @@
|
|||
// JS counterpart of ts-safe-022.
|
||||
const { server } = require("./harness");
|
||||
const { buildUser, buildTeam } = require("./factories");
|
||||
|
||||
describe("#comments.list", () => {
|
||||
it("should require auth", async () => {
|
||||
const res = await server.post("/api/comments.list");
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(401);
|
||||
});
|
||||
|
||||
it("should list comments", async () => {
|
||||
const team = await buildTeam();
|
||||
const user = await buildUser({ teamId: team.id });
|
||||
const res = await server.post("/api/comments.list", {
|
||||
body: {
|
||||
token: user.getJwtToken(),
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(200);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue