community fix

This commit is contained in:
phiresky 2023-09-20 20:55:43 +00:00
parent 1b7ab96887
commit f16aa9228d

View file

@ -27,6 +27,7 @@ import {
blockInstance, blockInstance,
waitUntil, waitUntil,
delay, delay,
waitForPost,
} from "./shared"; } from "./shared";
beforeAll(async () => { beforeAll(async () => {
@ -351,8 +352,9 @@ test("User blocks instance, communities are hidden", async () => {
expect(postRes.post_view.post.id).toBeDefined(); expect(postRes.post_view.post.id).toBeDefined();
// fetch post to alpha // fetch post to alpha
let alphaPost = await resolvePost(alpha, postRes.post_view.post); let alphaPost = (await resolvePost(alpha, postRes.post_view.post, false))
expect(alphaPost.post?.post).toBeDefined(); .post!;
expect(alphaPost.post).toBeDefined();
// post should be included in listing // post should be included in listing
let listing = await getPosts(alpha, "All"); let listing = await getPosts(alpha, "All");
@ -360,7 +362,7 @@ test("User blocks instance, communities are hidden", async () => {
expect(listing_ids).toContain(postRes.post_view.post.ap_id); expect(listing_ids).toContain(postRes.post_view.post.ap_id);
// block the beta instance // block the beta instance
await blockInstance(alpha, alphaPost.post!.community.instance_id, true); await blockInstance(alpha, alphaPost.community.instance_id, true);
// after blocking, post should not be in listing // after blocking, post should not be in listing
let listing2 = await getPosts(alpha, "All"); let listing2 = await getPosts(alpha, "All");
@ -368,7 +370,7 @@ test("User blocks instance, communities are hidden", async () => {
expect(listing_ids2.indexOf(postRes.post_view.post.ap_id)).toBe(-1); expect(listing_ids2.indexOf(postRes.post_view.post.ap_id)).toBe(-1);
// unblock instance again // unblock instance again
await blockInstance(alpha, alphaPost.post!.community.instance_id, false); await blockInstance(alpha, alphaPost.community.instance_id, false);
// post should be included in listing // post should be included in listing
let listing3 = await getPosts(alpha, "All"); let listing3 = await getPosts(alpha, "All");