diff --git a/src/bot.ts b/src/bot.ts index 562a59f8..7e583f7a 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -776,7 +776,7 @@ export class DiscordBot { let rooms; try { rooms = await this.channelSync.GetRoomIdsFromChannel(msg.channel); - if (rooms === null) { throw Error() } + if (rooms === null) { throw Error(); } } catch (err) { log.verbose("No bridged rooms to send message to. Oh well."); MetricPeg.get.requestOutcome(msg.id, true, "dropped"); diff --git a/test/test_discordbot.ts b/test/test_discordbot.ts index 17351703..918ff468 100644 --- a/test/test_discordbot.ts +++ b/test/test_discordbot.ts @@ -434,6 +434,7 @@ describe("DiscordBot", () => { it("should lock and unlock a channel early, if unlocked", async () => { const discordSendDelay = 500; const SHORTDELAY = 100; + const MINEXPECTEDDELAY = 95; const bot = new modDiscordBot.DiscordBot( "", { @@ -453,7 +454,8 @@ describe("DiscordBot", () => { bot.lockChannel(chan); await bot.waitUnlock(chan); const diff = Date.now() - t; - expect(diff).to.be.greaterThan(SHORTDELAY - 5); + // Date accuracy can be off by a few ms sometimes. + expect(diff).to.be.greaterThan(MINEXPECTEDDELAY); }); }); // });