Skip to content

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

DEV: Fix test leakage/flakes (#17407)

Jarek Radosz9365d4e86a73
diff --git a/app/assets/javascripts/discourse/tests/unit/services/screen-track-test.js b/app/assets/javascripts/discourse/tests/unit/services/screen-track-test.js
index 8a73f75066b..47883dec20f 100644
--- a/app/assets/javascripts/discourse/tests/unit/services/screen-track-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/services/screen-track-test.js
@@ -1,8 +1,9 @@
+import { settled } from "@ember/test-helpers";
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
discourseModule("Unit | Service | screen-track", function () {
- test("consolidateTimings", function (assert) {
+ test("consolidateTimings", async function (assert) {
const tracker = this.container.lookup("service:screen-track");
tracker.consolidateTimings({ 1: 10, 2: 5 }, 10, 1);
@@ -19,6 +20,10 @@ discourseModule("Unit | Service | screen-track", function () {
);
tracker.sendNextConsolidatedTiming();
+
+ // Wait for the requests to finish
+ await settled();
+
assert.equal(
tracker.highestReadFromCache(2),
4,