diff --git a/tests/unit/app/waves/[waveId]/applications/[applicationId]/comments/addCommentForm/addCommentAction.test.ts b/tests/unit/app/waves/[waveId]/applications/[applicationId]/comments/addCommentForm/addCommentAction.test.ts index 57ffd4cb..036f6e0e 100644 --- a/tests/unit/app/waves/[waveId]/applications/[applicationId]/comments/addCommentForm/addCommentAction.test.ts +++ b/tests/unit/app/waves/[waveId]/applications/[applicationId]/comments/addCommentForm/addCommentAction.test.ts @@ -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 = { @@ -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); });