summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Kangas <gabek@real-ity.com>2022-01-18 19:56:35 -0800
committerGabe Kangas <gabek@real-ity.com>2022-01-19 10:34:43 -0800
commit228c09b7e19def262d1053b308812838692c69ae (patch)
tree1a996142d91f22854c4e7a32750a88d1353617f9
parent2e1fbe28af9d252b3b4c6c26ec7e2c898a5e29ac (diff)
Tweak tests
-rw-r--r--test/automated/api/chatmoderation.test.js2
-rw-r--r--test/automated/api/lib/chat.js7
2 files changed, 6 insertions, 3 deletions
diff --git a/test/automated/api/chatmoderation.test.js b/test/automated/api/chatmoderation.test.js
index 84fc83a71..48585408c 100644
--- a/test/automated/api/chatmoderation.test.js
+++ b/test/automated/api/chatmoderation.test.js
@@ -63,6 +63,8 @@ test('verify we can make API call to mark message as hidden', async (done) => {
});
test('verify message has become hidden', async (done) => {
+ await new Promise((r) => setTimeout(r, 2000));
+
const res = await request
.get('/api/admin/chat/messages')
.expect(200)
diff --git a/test/automated/api/lib/chat.js b/test/automated/api/lib/chat.js
index e5c47e121..8b97f5336 100644
--- a/test/automated/api/lib/chat.js
+++ b/test/automated/api/lib/chat.js
@@ -11,7 +11,7 @@ async function registerChat() {
}
}
-function sendChatMessage(message, accessToken, done) {
+async function sendChatMessage(message, accessToken, done) {
const ws = new WebSocket(
`ws://localhost:8080/ws?accessToken=${accessToken}`,
{
@@ -19,9 +19,10 @@ function sendChatMessage(message, accessToken, done) {
}
);
- function onOpen() {
- ws.send(JSON.stringify(message), function () {
+ async function onOpen() {
+ ws.send(JSON.stringify(message), async function () {
ws.close();
+ await new Promise((r) => setTimeout(r, 2000));
done();
});
}