From 31f3677270af509ca48965de736e09e2df939778 Mon Sep 17 00:00:00 2001 From: phiresky Date: Thu, 21 Sep 2023 12:01:22 +0000 Subject: [PATCH] fix after merge --- api_tests/src/comment.spec.ts | 7 +++---- api_tests/src/community.spec.ts | 5 ++--- api_tests/src/post.spec.ts | 15 ++++++--------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/api_tests/src/comment.spec.ts b/api_tests/src/comment.spec.ts index 47321f9cc..fe8c3943e 100644 --- a/api_tests/src/comment.spec.ts +++ b/api_tests/src/comment.spec.ts @@ -504,8 +504,7 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t expect(alphaPost.post_view.community.local).toBe(true); // Make sure gamma sees it - let gammaPost = (await resolvePost(gamma, alphaPost.post_view.post, false))! - .post; + let gammaPost = (await resolvePost(gamma, alphaPost.post_view.post))!.post; if (!gammaPost) { throw "Missing gamma post"; @@ -670,8 +669,8 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde expect(updateRes.comment_view.comment.content).toBe(updatedCommentContent); // Get the post from alpha - let alphaPostB = (await resolvePost(alpha, postOnBetaRes.post_view.post)) - .post; + let alphaPostB = await waitForPost(alpha, postOnBetaRes.post_view.post); + if (!alphaPostB) { throw "Missing alpha post B"; } diff --git a/api_tests/src/community.spec.ts b/api_tests/src/community.spec.ts index f9d83c8cf..b81dd900c 100644 --- a/api_tests/src/community.spec.ts +++ b/api_tests/src/community.spec.ts @@ -240,7 +240,7 @@ test("Admin actions in remote community are not federated to origin", async () = expect(banRes.banned).toBe(true); // ban doesnt federate to community's origin instance alpha - let alphaPost = (await resolvePost(alpha, gammaPost.post, false)).post; + let alphaPost = (await resolvePost(alpha, gammaPost.post)).post; expect(alphaPost?.creator_banned_from_community).toBe(false); // and neither to gamma @@ -352,8 +352,7 @@ test("User blocks instance, communities are hidden", async () => { expect(postRes.post_view.post.id).toBeDefined(); // fetch post to alpha - let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) - .post!; + let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post!; expect(alphaPost.post).toBeDefined(); // post should be included in listing diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index 5e656e2f4..51a10293b 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -192,8 +192,7 @@ test("Sticky a post", async () => { expect(betaPost2?.post.featured_community).toBe(false); // Make sure that gamma cannot sticky the post on beta - let gammaPost = (await resolvePost(gamma, postRes.post_view.post, false)) - .post; + let gammaPost = (await resolvePost(gamma, postRes.post_view.post)).post; if (!gammaPost) { throw "Missing gamma post"; } @@ -300,8 +299,7 @@ test("Remove a post from admin and community on different instance", async () => } let postRes = await createPost(gamma, gammaCommunity.id); - let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) - .post; + let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post; if (!alphaPost) { throw "Missing alpha post"; } @@ -310,7 +308,7 @@ test("Remove a post from admin and community on different instance", async () => expect(removedPost.post_view.post.name).toBe(postRes.post_view.post.name); // Make sure lemmy beta sees post is NOT removed - let betaPost = (await resolvePost(beta, postRes.post_view.post, false)).post; + let betaPost = (await resolvePost(beta, postRes.post_view.post)).post; if (!betaPost) { throw "Missing beta post"; } @@ -504,7 +502,7 @@ test("A and G subscribe to B (center) A posts, it gets announced to G", async () let postRes = await createPost(alpha, betaCommunity.community.id); expect(postRes.post_view.post).toBeDefined(); - let betaPost = (await resolvePost(gamma, postRes.post_view.post, false)).post; + let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post; expect(betaPost?.post.name).toBeDefined(); }); @@ -517,8 +515,7 @@ test("Report a post", async () => { let postRes = await createPost(beta, betaCommunity.community.id); expect(postRes.post_view.post).toBeDefined(); - let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false)) - .post; + let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post; if (!alphaPost) { throw "Missing alpha post"; } @@ -563,7 +560,7 @@ test("Sanitize HTML", async () => { "<script>alert('xss');</script> hello &"'", ); - let alphaPost = (await resolvePost(alpha, post.post_view.post, false)).post; + let alphaPost = (await resolvePost(alpha, post.post_view.post)).post; // second escaping over federation, avoid double escape of & expect(alphaPost?.post.body).toBe( "<script>alert('xss');</script> hello &"'",