feat: Add missing comments.info endpoint, fix misnamed types
This commit is contained in:
@@ -204,3 +204,41 @@ describe("#comments.create", () => {
|
||||
expect(res.status).toEqual(400);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#comments.info", () => {
|
||||
it("should require authentication", async () => {
|
||||
const res = await server.post("/api/comments.info");
|
||||
const body = await res.json();
|
||||
expect(res.status).toEqual(401);
|
||||
expect(body).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should return comment info", async () => {
|
||||
const team = await buildTeam();
|
||||
const user = await buildUser({ teamId: team.id });
|
||||
const document = await buildDocument({
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
});
|
||||
const comment = await buildComment({
|
||||
userId: user.id,
|
||||
teamId: team.id,
|
||||
documentId: document.id,
|
||||
});
|
||||
const res = await server.post("/api/comments.info", {
|
||||
body: {
|
||||
token: user.getJwtToken(),
|
||||
id: comment.id,
|
||||
},
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.id).toEqual(comment.id);
|
||||
expect(body.data.data).toEqual(comment.data);
|
||||
expect(body.policies.length).toEqual(1);
|
||||
expect(body.policies[0].abilities.read).toEqual(true);
|
||||
expect(body.policies[0].abilities.update).toEqual(true);
|
||||
expect(body.policies[0].abilities.delete).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user