From ff2a7c5136cd373e19c0b71aba28a7af1781b299 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 12:04:40 +0100 Subject: [PATCH] cleanup --- api_tests/src/community.spec.ts | 14 +++++++++----- api_tests/src/shared.ts | 16 ++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/api_tests/src/community.spec.ts b/api_tests/src/community.spec.ts index 77b68e2fc..36ddf2505 100644 --- a/api_tests/src/community.spec.ts +++ b/api_tests/src/community.spec.ts @@ -34,6 +34,7 @@ import { longDelay, editCommunity, unfollows, + allowInstance, } from "./shared"; import { EditCommunity, EditSite } from "lemmy-js-client"; @@ -455,9 +456,12 @@ test("Dont receive community activities after unsubscribe", async () => { expect(communityRes1.community_view.counts.subscribers).toBe(2); // temporarily block alpha, so that it doesn't know about unfollow - let editSiteForm: EditSite = {}; - editSiteForm.allowed_instances = ["lemmy-epsilon"]; - await beta.editSite(editSiteForm); + var allow_instance_params: AdminAllowInstanceParams = { + instance: "lemmy-alpha", + allow: false, + reason: undefined, + }; + await beta.adminAllowInstance(allow_instance_params); await longDelay(); // unfollow @@ -471,8 +475,8 @@ test("Dont receive community activities after unsubscribe", async () => { expect(communityRes2.community_view.counts.subscribers).toBe(2); // unblock alpha - editSiteForm.allowed_instances = betaAllowedInstances; - await beta.editSite(editSiteForm); + allow_instance_params.allow = true; + await beta.adminAllowInstance(allow_instance_params); await longDelay(); // create a post, it shouldnt reach beta diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index 60f8bef76..1f9402095 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -105,13 +105,6 @@ export const gamma = new LemmyHttp(gammaUrl, { fetchFunction }); export const delta = new LemmyHttp(deltaUrl, { fetchFunction }); export const epsilon = new LemmyHttp(epsilonUrl, { fetchFunction }); -export const betaAllowedInstances = [ - "lemmy-alpha", - "lemmy-gamma", - "lemmy-delta", - "lemmy-epsilon", -]; - const password = "lemmylemmy"; export async function setupLogins() { @@ -175,7 +168,7 @@ export async function setupLogins() { await delta.editSite(editSiteForm); await epsilon.editSite(editSiteForm); - // Set the blocksfor each + // Set the blocks for each await allowInstance(alpha, "lemmy-beta"); await allowInstance(alpha, "lemmy-gamma"); await allowInstance(alpha, "lemmy-delta"); @@ -209,12 +202,11 @@ export async function setupLogins() { } } -async function allowInstance( - api: LemmyHttp,instance: string) { - const params: AdminAllowInstanceParams = { +export async function allowInstance(api: LemmyHttp, instance: string) { + const params: AdminAllowInstanceParams = { instance, allow: true, - reason: undefined + reason: undefined, }; await api.adminAllowInstance(params); }