ember/no-test-and-then
November 8, 2022 ยท View on GitHub
๐ผ This rule is enabled in the โ
recommended config.
Use await instead of andThen test wait helper.
It's no longer necessary to use the andThen test wait helper now that the cleaner async/await syntax is available.
Examples
Examples of incorrect code for this rule:
test('behaves correctly', function (assert) {
click('.button');
andThen(() => {
assert.ok(this.myAction.calledOnce);
});
});
Examples of correct code for this rule:
test('behaves correctly', async function (assert) {
await click('.button');
assert.ok(this.myAction.calledOnce);
});
Migration
- async-await-codemod can help convert async function calls / promise chains to use
await - ember-test-helpers-codemod has transforms such as click that can be modified to call
makeAwait()anddropAndThen()on the function calls that you're trying to bring into compliance with this rule