Skip to content

A platform for community discussion. Free, open, simple.

DEV: Make `publishToMessageBus()` wait for settled (#17575)

Jarek Radosza4e5bd272a98
diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
index 975e67078ed..6fe1401eae9 100644
--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
@@ -484,11 +484,13 @@ export function exists(selector) {
return count(selector) > 0;
}
-export function publishToMessageBus(channelPath, ...args) {
+export async function publishToMessageBus(channelPath, ...args) {
args = cloneJSON(args);
MessageBus.callbacks
.filterBy("channel", channelPath)
.forEach((c) => c.func(...args));
+
+ await settled();
}
export async function selectText(selector, endOffset = null) {