removeCommunity,
getCommunity,
followCommunity,
- delay,
} from './shared';
import { CommunityView } from 'lemmy-js-client';
let prevName = communityRes.community_view.community.name;
let communityRes2: any = await createCommunity(alpha, prevName);
expect(communityRes2['error']).toBe('community_already_exists');
- await delay();
// Cache the community on beta, make sure it has the other fields
let searchShort = `!${prevName}@lemmy-alpha:8541`;
test('Delete community', async () => {
let communityRes = await createCommunity(beta);
- await delay();
// Cache the community on Alpha
let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);
let communityOnAlpha = search.communities[0];
assertCommunityFederation(communityOnAlpha, communityRes.community_view);
- await delay();
// Follow the community from alpha
let follow = await followCommunity(
// Make sure the follow response went through
expect(follow.community_view.community.local).toBe(false);
- await delay();
let deleteCommunityRes = await deleteCommunity(
beta,
communityRes.community_view.community.id
);
expect(deleteCommunityRes.community_view.community.deleted).toBe(true);
- await delay();
// Make sure it got deleted on A
let communityOnAlphaDeleted = await getCommunity(
communityOnAlpha.community.id
);
expect(communityOnAlphaDeleted.community_view.community.deleted).toBe(true);
- await delay();
// Undelete
let undeleteCommunityRes = await deleteCommunity(
communityRes.community_view.community.id
);
expect(undeleteCommunityRes.community_view.community.deleted).toBe(false);
- await delay();
// Make sure it got undeleted on A
let communityOnAlphaUnDeleted = await getCommunity(
test('Remove community', async () => {
let communityRes = await createCommunity(beta);
- await delay();
// Cache the community on Alpha
let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);
let communityOnAlpha = search.communities[0];
assertCommunityFederation(communityOnAlpha, communityRes.community_view);
- await delay();
// Follow the community from alpha
let follow = await followCommunity(
// Make sure the follow response went through
expect(follow.community_view.community.local).toBe(false);
- await delay();
let removeCommunityRes = await removeCommunity(
beta,
communityRes.community_view.community.id
);
expect(removeCommunityRes.community_view.community.removed).toBe(true);
- await delay();
// Make sure it got Removed on A
let communityOnAlphaRemoved = await getCommunity(
communityOnAlpha.community.id
);
expect(communityOnAlphaRemoved.community_view.community.removed).toBe(true);
- await delay();
// unremove
let unremoveCommunityRes = await removeCommunity(
communityRes.community_view.community.id
);
expect(unremoveCommunityRes.community_view.community.removed).toBe(false);
- await delay();
// Make sure it got undeleted on A
let communityOnAlphaUnRemoved = await getCommunity(
test('Search for beta community', async () => {
let communityRes = await createCommunity(beta);
expect(communityRes.community_view.community.name).toBeDefined();
- await delay();
let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);