DEV: Fix test leakage/flakes (#17407)

Fixes failures like:

```
Unhandled request in test environment: /forum/topics/timings (POST)
```
This commit is contained in:
Jarek Radosz 2022-07-10 10:52:42 +02:00 committed by GitHub
parent 8bf11ae0ce
commit 9365d4e86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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,