From a6ea8897232dac0e9a633fc7752f4844b53761b1 Mon Sep 17 00:00:00 2001 From: "Andrew Morgan andrew@amorgan.xyz" <andrew@amorgan.xyz> Date: Sun, 20 May 2018 19:17:25 +0200 Subject: [PATCH] Fix tests to account for concurrency :) --- test/test_discordbot.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/test_discordbot.ts b/test/test_discordbot.ts index 88866ca..45f820d 100644 --- a/test/test_discordbot.ts +++ b/test/test_discordbot.ts @@ -104,8 +104,9 @@ describe("DiscordBot", () => { let checkMsgSent = false; discordBot.SendMatrixMessage = (...args) => checkMsgSent = true; - discordBot.OnMessageUpdate(oldMsg, newMsg); - Chai.assert.equal(checkMsgSent, false); + discordBot.OnMessageUpdate(oldMsg, newMsg).then(() => { + Chai.assert.equal(checkMsgSent, false); + }); }); it("should send a matrix message on an edited discord message", () => { @@ -130,8 +131,9 @@ describe("DiscordBot", () => { let checkMsgSent = false; discordBot.SendMatrixMessage = (...args) => checkMsgSent = true; - discordBot.OnMessageUpdate(oldMsg, newMsg); - Chai.assert.equal(checkMsgSent, true); + discordBot.OnMessageUpdate(oldMsg, newMsg).then(() => { + Chai.assert.equal(checkMsgSent, true); + }); }); }); -- GitLab