From 597bebddb8cd3ad3cb0e4980426991e4f3722fac Mon Sep 17 00:00:00 2001
From: Will Hunt <will@half-shot.uk>
Date: Sat, 11 May 2019 20:49:27 +0100
Subject: [PATCH] Fix tests

---
 src/bot.ts              | 2 +-
 test/test_discordbot.ts | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bot.ts b/src/bot.ts
index 81f892b..f73671c 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -106,6 +106,7 @@ export class DiscordBot {
         // init vars
         this.sentMessages = [];
         this.discordMessageQueue = {};
+        this.channelLocks = {};
         this.lastEventIds = {};
     }
 
@@ -183,7 +184,6 @@ export class DiscordBot {
 
     public async run(): Promise<void> {
         const client = await this.clientFactory.getClient();
-
         if (!this.config.bridge.disableTypingNotifications) {
             client.on("typingStart", async (c, u) => {
                 try {
diff --git a/test/test_discordbot.ts b/test/test_discordbot.ts
index 2eeccfc..4dd1ad8 100644
--- a/test/test_discordbot.ts
+++ b/test/test_discordbot.ts
@@ -382,7 +382,7 @@ describe("DiscordBot", () => {
             const CHANID = 123;
             // Send delay of 50ms, 2 seconds / 50ms - 5 for safety.
             for (let i = 0; i < ITERATIONS; i++) {
-              await client.emit("message", { n: i, channel: { id: CHANID} });
+                await client.emit("message", { channel: { guild: { id: CHANID }, id: CHANID} });
             }
             await discordBot.discordMessageQueue[CHANID];
         });
@@ -409,7 +409,7 @@ describe("DiscordBot", () => {
             const CHANID = 123;
             // Send delay of 50ms, 2 seconds / 50ms - 5 for safety.
             for (let n = 0; n < ITERATIONS; n++) {
-                await client.emit("message", { n, channel: { id: CHANID} });
+                await client.emit("message", { n, channel: { guild: { id: CHANID }, id: CHANID} });
             }
             await discordBot.discordMessageQueue[CHANID];
             assert.equal(expected, ITERATIONS);
-- 
GitLab