Skip to content

Commit

Permalink
Create another application to test addComment action verification
Browse files Browse the repository at this point in the history
  • Loading branch information
ClumsyVlad committed May 10, 2024
1 parent 231bee6 commit b5fada6
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const userId = "user";
const anotherUserId = "anotherUser";
const waveId = 1;
const applicationId = "f8e46fab-f2c4-4c46-85ca-9e5cbf716d39";
const anotherApplicationId = "92effe54-7821-4932-be1f-6fa264fa7ec6"
const categoryId = "7979fbc1-1a84-4b75-8f7e-bea6f9bf0a99";

const defaultActionArgs = {
Expand Down Expand Up @@ -81,15 +82,29 @@ describe("app/waves/[waveId]/applications/[applicationId]/comments/addCommentFor
});

it("device verified - own application", async () => {
const ownArgs = {
...defaultActionArgs,
application: {
...defaultActionArgs.application,
userId,
id: anotherApplicationId,
},
};

await createUser(userId);
await createApplication({
applicationId: anotherApplicationId,
categoryId,
userId,
waveId,
isDraft: false,
});
mockUserSession({ userId, credentialType: "device" });

await addCommentAction({
...defaultActionArgs,
application: { ...defaultActionArgs.application, userId },
});
await addCommentAction(ownArgs);

const comments = await db.query.Comment.findMany();

expect(comments).toHaveLength(1);
});

Expand Down

0 comments on commit b5fada6

Please sign in to comment.