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