DEV: Update a topic test to use `settled` (#30443)

…instead of `next()`/`assert.async()/done()`
This commit is contained in:
Jarek Radosz 2024-12-23 15:49:38 +01:00 committed by GitHub
parent 3198326cda
commit c1818bf40e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import EmberObject from "@ember/object";
import { getOwner } from "@ember/owner";
import { next } from "@ember/runloop";
import { settled } from "@ember/test-helpers";
import { setupTest } from "ember-qunit";
import { module, test } from "qunit";
@ -595,7 +594,7 @@ module("Unit | Controller | topic", function (hooks) {
);
});
test("deletePost - no modal is shown if post does not have replies", function (assert) {
test("deletePost - no modal is shown if post does not have replies", async function (assert) {
pretender.get("/posts/2/reply-ids.json", () => response([]));
let destroyed;
@ -616,12 +615,9 @@ module("Unit | Controller | topic", function (hooks) {
const controller = getOwner(this).lookup("controller:topic");
controller.setProperties({ model, currentUser });
const done = assert.async();
controller.send("deletePost", post);
await settled();
next(() => {
assert.true(destroyed, "post was destroyed");
done();
});
assert.true(destroyed, "post was destroyed");
});
});