mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Use async functions in tests (#9087)
This change both improves readability and fixes potential race-condition issues where promises were nested instead of being chained. Also includes: * Use arrow functions and Promise shorthands * Remove the obsolete `asyncTestDiscourse` helper
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
moduleFor("controller:history");
|
||||
|
||||
QUnit.test("displayEdit", function(assert) {
|
||||
QUnit.test("displayEdit", async function(assert) {
|
||||
const HistoryController = this.subject();
|
||||
|
||||
HistoryController.setProperties({
|
||||
@@ -82,8 +82,8 @@ QUnit.test("displayEdit", function(assert) {
|
||||
}
|
||||
});
|
||||
|
||||
HistoryController.bodyDiffChanged().then(() => {
|
||||
const output = HistoryController.get("bodyDiff");
|
||||
assert.equal(output, expectedOutput, "it keeps safe HTML");
|
||||
});
|
||||
await HistoryController.bodyDiffChanged();
|
||||
|
||||
const output = HistoryController.get("bodyDiff");
|
||||
assert.equal(output, expectedOutput, "it keeps safe HTML");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user