From 5698dd77710ab62711f3fa80bf4b3257e902e4cb Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 22 Mar 2022 15:50:47 -0400 Subject: [PATCH] Trying to fix api tests 1 --- api_tests/src/comment.spec.ts | 5 +++-- api_tests/src/post.spec.ts | 12 +++--------- api_tests/src/shared.ts | 7 +++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/api_tests/src/comment.spec.ts b/api_tests/src/comment.spec.ts index 55d0c5d46..314f18ecc 100644 --- a/api_tests/src/comment.spec.ts +++ b/api_tests/src/comment.spec.ts @@ -23,6 +23,7 @@ import { listCommentReports, randomString, API, + unfollows, } from './shared'; import { CommentView } from 'lemmy-js-client'; @@ -32,6 +33,7 @@ let postRes: PostResponse; beforeAll(async () => { await setupLogins(); + await unfollows(); await followBeta(alpha); await followBeta(gamma); let betaCommunity = (await resolveBetaCommunity(alpha)).community; @@ -42,8 +44,7 @@ beforeAll(async () => { }); afterAll(async () => { - await unfollowRemotes(alpha); - await unfollowRemotes(gamma); + await unfollows(); }); function assertCommentFederation( diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index 3e834dbe4..0e9276f93 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -29,7 +29,8 @@ import { randomString, registerUser, API, - getSite + getSite, + unfollows } from './shared'; import { PostView, CommunityView } from 'lemmy-js-client'; @@ -46,13 +47,6 @@ afterAll(async () => { 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); @@ -400,4 +394,4 @@ test('Report a post', async () => { 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 +}); diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index da606b1fa..4f305237e 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -653,3 +653,10 @@ export function randomString(length: number): string { } return result; } + +export async function unfollows() { + await unfollowRemotes(alpha); + await unfollowRemotes(gamma); + await unfollowRemotes(delta); + await unfollowRemotes(epsilon); +}