randomString,
registerUser,
API,
- getSite
+ getSite,
+ unfollows
} from './shared';
import { PostView, CommunityView } from 'lemmy-js-client';
await unfollows();
});
-async function unfollows() {
- await unfollowRemotes(alpha);
- await unfollowRemotes(gamma);
- await unfollowRemotes(delta);
- await unfollowRemotes(epsilon);
-}
-
function assertPostFederation(postOne: PostView, postTwo: PostView) {
expect(postOne.post.ap_id).toBe(postTwo.post.ap_id);
expect(postOne.post.name).toBe(postTwo.post.name);
});
test('Remove a post from admin and community on different instance', async () => {
- let postRes = await createPost(alpha, betaCommunity.community.id);
+ let postRes = await createPost(gamma, betaCommunity.community.id);
- let removedPost = await removePost(alpha, true, postRes.post_view.post);
+ let alphaPost = (await resolvePost(alpha, postRes.post_view.post)).post;
+ let removedPost = await removePost(alpha, true, alphaPost.post);
expect(removedPost.post_view.post.removed).toBe(true);
expect(removedPost.post_view.post.name).toBe(postRes.post_view.post.name);
expect(betaPost.post.removed).toBe(false);
// Undelete
- let undeletedPost = await removePost(alpha, false, postRes.post_view.post);
+ let undeletedPost = await removePost(alpha, false, alphaPost.post);
expect(undeletedPost.post_view.post.removed).toBe(false);
// Make sure lemmy beta sees post is undeleted
expect(betaPost.post.name).toBeDefined();
});
-test('A and G subscribe to B (center) A posts, it gets announced to G', async () => {
- let postRes = await createPost(alpha, betaCommunity.community.id);
- expect(postRes.post_view.post).toBeDefined();
-
- let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post;
- expect(betaPost.post.name).toBeDefined();
-});
-
test('Enforce site ban for federated user', async () => {
// create a test user
let alphaUserJwt = await registerUser(alpha);
expect(searchBeta2.posts[0]).toBeDefined();
});
+
+test('A and G subscribe to B (center) A posts, it gets announced to G', async () => {
+ let postRes = await createPost(alpha, betaCommunity.community.id);
+ expect(postRes.post_view.post).toBeDefined();
+
+ let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post;
+ expect(betaPost.post.name).toBeDefined();
+});
+
test('Report a post', async () => {
let betaCommunity = (await resolveBetaCommunity(beta)).community;
let postRes = await createPost(beta, betaCommunity.community.id);
expect(betaReport.original_post_url).toBe(alphaReport.original_post_url);
expect(betaReport.original_post_body).toBe(alphaReport.original_post_body);
expect(betaReport.reason).toBe(alphaReport.reason);
-});
\ No newline at end of file
+});