diff --git a/test/integration/commands/commandUtils.ts b/test/integration/commands/commandUtils.ts index c1839a3..af911d6 100644 --- a/test/integration/commands/commandUtils.ts +++ b/test/integration/commands/commandUtils.ts @@ -9,7 +9,7 @@ import { MatrixClient } from "matrix-bot-sdk"; * @param targetEventThunk A function that produces an event ID when called. This event ID is then used to listen for a reaction. * @returns The reaction event. */ -export async function onReactionTo(client: MatrixClient, targetRoom: string, reactionKey: string, targetEventThunk: () => Promise): Promise { +export async function getFirstReaction(client: MatrixClient, targetRoom: string, reactionKey: string, targetEventThunk: () => Promise): Promise { let reactionEvents = []; const addEvent = function (roomId, event) { if (roomId !== targetRoom) return; diff --git a/test/integration/commands/redactCommandTest.ts b/test/integration/commands/redactCommandTest.ts index 153abab..3971e0d 100644 --- a/test/integration/commands/redactCommandTest.ts +++ b/test/integration/commands/redactCommandTest.ts @@ -4,7 +4,7 @@ import config from "../../../src/config"; import { newTestUser } from "../clientHelper"; import { getMessagesByUserIn } from "../../../src/utils"; import { LogService } from "matrix-bot-sdk"; -import { onReactionTo } from "./commandUtils"; +import { getFirstReaction } from "./commandUtils"; describe("Test: The redaction command", function () { it('Mjölnir redacts all of the events sent by a spammer when instructed to by giving their id and a room id.', async function() { @@ -34,7 +34,7 @@ import { onReactionTo } from "./commandUtils"; try { moderator.start(); - await onReactionTo(moderator, this.mjolnir.managementRoomId, '✅', async () => { + await getFirstReaction(moderator, this.mjolnir.managementRoomId, '✅', async () => { return await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir redact ${badUserId} ${targetRoom}` }); }); } finally { @@ -81,7 +81,7 @@ import { onReactionTo } from "./commandUtils"; try { moderator.start(); - await onReactionTo(moderator, this.mjolnir.managementRoomId, '✅', async () => { + await getFirstReaction(moderator, this.mjolnir.managementRoomId, '✅', async () => { return await moderator.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir redact ${badUserId}` }); }); } finally { @@ -117,7 +117,7 @@ import { onReactionTo } from "./commandUtils"; try { moderator.start(); - await onReactionTo(moderator, this.mjolnir.managementRoomId, '✅', async () => { + await getFirstReaction(moderator, this.mjolnir.managementRoomId, '✅', async () => { return await moderator.sendMessage(this.mjolnir.managementRoomId, {msgtype: 'm.text', body: `!mjolnir redact https://matrix.to/#/${encodeURIComponent(targetRoom)}/${encodeURIComponent(eventToRedact)}`}); }); } finally {