1 jest.setTimeout(120000);
2 import {SubscribedType} from 'lemmy-js-client';
12 beforeAll(async () => {
16 afterAll(async () => {
17 await unfollowRemotes(alpha);
20 test('Follow federated community', async () => {
21 let betaCommunity = (await resolveBetaCommunity(alpha)).community;
22 let follow = await followCommunity(
25 betaCommunity.community.id
28 // Make sure the follow response went through
29 expect(follow.community_view.community.local).toBe(false);
30 expect(follow.community_view.community.name).toBe('main');
31 expect(follow.community_view.subscribed).toBe(SubscribedType.Pending);
33 // Check it from local
34 let site = await getSite(alpha);
35 let remoteCommunityId = site.my_user.follows.find(
36 c => c.community.local == false
38 expect(remoteCommunityId).toBeDefined();
41 let unfollow = await followCommunity(alpha, false, remoteCommunityId);
42 expect(unfollow.community_view.subscribed).toBe(SubscribedType.NotSubscribed);
44 // Make sure you are unsubbed locally
45 let siteUnfollowCheck = await getSite(alpha);
46 expect(siteUnfollowCheck.my_user.follows.length).toBeGreaterThanOrEqual(1);