1 jest.setTimeout(120000);
2 import { SubscribedType } from "lemmy-js-client";
13 beforeAll(async () => {
17 afterAll(async () => {
18 await unfollowRemotes(alpha);
21 test("Follow federated community", async () => {
22 let betaCommunity = (await resolveBetaCommunity(alpha)).community.unwrap();
23 let follow = await followCommunity(alpha, true, betaCommunity.community.id);
25 // Make sure the follow response went through
26 expect(follow.community_view.community.local).toBe(false);
27 expect(follow.community_view.community.name).toBe("main");
28 expect(follow.community_view.subscribed).toBe(SubscribedType.Subscribed);
30 // Check it from local
31 let site = await getSite(alpha);
32 let remoteCommunityId = site.my_user
34 .follows.find(c => c.community.local == false).community.id;
35 expect(remoteCommunityId).toBeDefined();
36 expect(site.my_user.unwrap().follows.length).toBe(2);
39 let unfollow = await followCommunity(alpha, false, remoteCommunityId);
40 expect(unfollow.community_view.subscribed).toBe(SubscribedType.NotSubscribed);
42 // Make sure you are unsubbed locally
43 let siteUnfollowCheck = await getSite(alpha);
44 expect(siteUnfollowCheck.my_user.unwrap().follows.length).toBe(1);