mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-22 20:43:05 +00:00
Trying to fix api tests 1
This commit is contained in:
parent
a10bf7d410
commit
5698dd7771
3 changed files with 13 additions and 11 deletions
|
@ -23,6 +23,7 @@ import {
|
||||||
listCommentReports,
|
listCommentReports,
|
||||||
randomString,
|
randomString,
|
||||||
API,
|
API,
|
||||||
|
unfollows,
|
||||||
} from './shared';
|
} from './shared';
|
||||||
import { CommentView } from 'lemmy-js-client';
|
import { CommentView } from 'lemmy-js-client';
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ let postRes: PostResponse;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await setupLogins();
|
await setupLogins();
|
||||||
|
await unfollows();
|
||||||
await followBeta(alpha);
|
await followBeta(alpha);
|
||||||
await followBeta(gamma);
|
await followBeta(gamma);
|
||||||
let betaCommunity = (await resolveBetaCommunity(alpha)).community;
|
let betaCommunity = (await resolveBetaCommunity(alpha)).community;
|
||||||
|
@ -42,8 +44,7 @@ beforeAll(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await unfollowRemotes(alpha);
|
await unfollows();
|
||||||
await unfollowRemotes(gamma);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function assertCommentFederation(
|
function assertCommentFederation(
|
||||||
|
|
|
@ -29,7 +29,8 @@ import {
|
||||||
randomString,
|
randomString,
|
||||||
registerUser,
|
registerUser,
|
||||||
API,
|
API,
|
||||||
getSite
|
getSite,
|
||||||
|
unfollows
|
||||||
} from './shared';
|
} from './shared';
|
||||||
import { PostView, CommunityView } from 'lemmy-js-client';
|
import { PostView, CommunityView } from 'lemmy-js-client';
|
||||||
|
|
||||||
|
@ -46,13 +47,6 @@ afterAll(async () => {
|
||||||
await unfollows();
|
await unfollows();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function unfollows() {
|
|
||||||
await unfollowRemotes(alpha);
|
|
||||||
await unfollowRemotes(gamma);
|
|
||||||
await unfollowRemotes(delta);
|
|
||||||
await unfollowRemotes(epsilon);
|
|
||||||
}
|
|
||||||
|
|
||||||
function assertPostFederation(postOne: PostView, postTwo: PostView) {
|
function assertPostFederation(postOne: PostView, postTwo: PostView) {
|
||||||
expect(postOne.post.ap_id).toBe(postTwo.post.ap_id);
|
expect(postOne.post.ap_id).toBe(postTwo.post.ap_id);
|
||||||
expect(postOne.post.name).toBe(postTwo.post.name);
|
expect(postOne.post.name).toBe(postTwo.post.name);
|
||||||
|
@ -400,4 +394,4 @@ test('Report a post', async () => {
|
||||||
expect(betaReport.original_post_url).toBe(alphaReport.original_post_url);
|
expect(betaReport.original_post_url).toBe(alphaReport.original_post_url);
|
||||||
expect(betaReport.original_post_body).toBe(alphaReport.original_post_body);
|
expect(betaReport.original_post_body).toBe(alphaReport.original_post_body);
|
||||||
expect(betaReport.reason).toBe(alphaReport.reason);
|
expect(betaReport.reason).toBe(alphaReport.reason);
|
||||||
});
|
});
|
||||||
|
|
|
@ -653,3 +653,10 @@ export function randomString(length: number): string {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function unfollows() {
|
||||||
|
await unfollowRemotes(alpha);
|
||||||
|
await unfollowRemotes(gamma);
|
||||||
|
await unfollowRemotes(delta);
|
||||||
|
await unfollowRemotes(epsilon);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue