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 await followCommunity(alpha, true, betaCommunity.community.id);
24 betaCommunity = (await resolveBetaCommunity(alpha)).community.unwrap();
26 // Make sure the follow response went through
27 expect(betaCommunity.community.local).toBe(false);
28 expect(betaCommunity.community.name).toBe("main");
29 expect(betaCommunity.subscribed).toBe(SubscribedType.Subscribed);
31 // Check it from local
32 let site = await getSite(alpha);
33 let remoteCommunityId = site.my_user
35 .follows.find(c => c.community.local == false).community.id;
36 expect(remoteCommunityId).toBeDefined();
37 expect(site.my_user.unwrap().follows.length).toBe(2);
40 let unfollow = await followCommunity(alpha, false, remoteCommunityId);
41 expect(unfollow.community_view.subscribed).toBe(SubscribedType.NotSubscribed);
43 // Make sure you are unsubbed locally
44 let siteUnfollowCheck = await getSite(alpha);
45 expect(siteUnfollowCheck.my_user.unwrap().follows.length).toBe(1);