1 jest.setTimeout(120000);
6 searchForBetaCommunity,
14 beforeAll(async () => {
18 test('Create community', async () => {
19 let communityRes = await createCommunity(alpha);
20 expect(communityRes.community.name).toBeDefined();
23 let prevName = communityRes.community.name;
24 let communityRes2 = await createCommunity(alpha, prevName);
25 expect(communityRes2['error']).toBe('community_already_exists');
28 // Cache the community on beta, make sure it has the other fields
29 let searchShort = `!${prevName}@lemmy-alpha:8541`;
30 let search = await searchForCommunity(beta, searchShort);
31 let communityOnBeta = search.communities[0];
32 expect(communityOnBeta.name).toBe(communityRes.community.name);
33 expect(communityOnBeta.title).toBe(communityRes.community.title);
34 expect(communityOnBeta.description).toBe(communityRes.community.description);
35 expect(communityOnBeta.icon).toBe(communityRes.community.icon);
36 expect(communityOnBeta.banner).toBe(communityRes.community.banner);
39 test('Delete community', async () => {
40 let communityRes = await createCommunity(beta);
42 let deleteCommunityRes = await deleteCommunity(
45 communityRes.community.id
47 expect(deleteCommunityRes.community.deleted).toBe(true);
50 // Make sure it got deleted on A
51 let search = await searchForBetaCommunity(alpha);
52 let communityA = search.communities[0];
53 // TODO this fails currently, because no updates are pushed
54 // expect(communityA.deleted).toBe(true);
57 let undeleteCommunityRes = await deleteCommunity(
60 communityRes.community.id
62 expect(undeleteCommunityRes.community.deleted).toBe(false);
65 // Make sure it got undeleted on A
66 let search2 = await searchForBetaCommunity(alpha);
67 let communityA2 = search2.communities[0];
68 // TODO this fails currently, because no updates are pushed
69 // expect(communityA2.deleted).toBe(false);
72 test('Remove community', async () => {
73 let communityRes = await createCommunity(beta);
75 let removeCommunityRes = await removeCommunity(
78 communityRes.community.id
80 expect(removeCommunityRes.community.removed).toBe(true);
82 // Make sure it got removed on A
83 let search = await searchForBetaCommunity(alpha);
84 let communityA = search.communities[0];
85 // TODO this fails currently, because no updates are pushed
86 // expect(communityA.removed).toBe(true);
90 let unremoveCommunityRes = await removeCommunity(
93 communityRes.community.id
95 expect(unremoveCommunityRes.community.removed).toBe(false);
98 // Make sure it got unremoved on A
99 let search2 = await searchForBetaCommunity(alpha);
100 let communityA2 = search2.communities[0];
101 // TODO this fails currently, because no updates are pushed
102 // expect(communityA2.removed).toBe(false);
105 test('Search for beta community', async () => {
106 let search = await searchForBetaCommunity(alpha);
107 expect(search.communities[0].name).toBe('main');