From ea793ffe984d2ee54dd4fd11416314f47becef0b Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 4 Mar 2024 11:36:57 +0100 Subject: [PATCH] fix test --- api_tests/src/post.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index c5f91017e..268a5c942 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -270,8 +270,10 @@ test("Lock a post", async () => { post => !!post && post.post.locked, ); - // Try to make a new comment there, on alpha - await expect(createComment(alpha, alphaPost1.post.id)).rejects.toStrictEqual( + // Try to make a new comment there, on alpha. For this we need to create a normal + // user account because admins/mods can comment in locked posts. + let user = await registerUser(alpha, alphaUrl); + await expect(createComment(user, alphaPost1.post.id)).rejects.toStrictEqual( Error("locked"), ); @@ -290,7 +292,7 @@ test("Lock a post", async () => { expect(alphaPost2.post.locked).toBe(false); // Try to create a new comment, on alpha - let commentAlpha = await createComment(alpha, alphaPost1.post.id); + let commentAlpha = await createComment(user, alphaPost1.post.id); expect(commentAlpha).toBeDefined(); });