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;
23 let follow = await followCommunity(
26 betaCommunity.community.id
29 // Wait for it to accept on the alpha side ( follows are async )
32 // Make sure the follow response went through
33 expect(follow.community_view.community.local).toBe(false);
34 expect(follow.community_view.community.name).toBe('main');
35 expect(follow.community_view.subscribed).toBe(SubscribedType.Pending);
37 // Check it from local
38 let site = await getSite(alpha);
39 let remoteCommunityId = site.my_user.follows.find(
40 c => c.community.local == false
42 expect(remoteCommunityId).toBeDefined();
43 expect(site.my_user.follows.length).toBe(1);
46 let unfollow = await followCommunity(alpha, false, remoteCommunityId);
47 expect(unfollow.community_view.subscribed).toBe(SubscribedType.NotSubscribed);
49 // Make sure you are unsubbed locally
50 let siteUnfollowCheck = await getSite(alpha);
51 expect(siteUnfollowCheck.my_user.follows.length).toBe(0);