From c1818bf40e24fe9aaa936e14f06134a74a03e3bd Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 23 Dec 2024 15:49:38 +0100 Subject: [PATCH] DEV: Update a topic test to use `settled` (#30443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …instead of `next()`/`assert.async()/done()` --- .../discourse/tests/unit/controllers/topic-test.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js index df0ad7dc52f..5d80169de2d 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js @@ -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"); }); });