Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.27 KB

no-test-and-then.md

File metadata and controls

34 lines (24 loc) · 1.27 KB

no-test-and-then

✅ The "extends": "plugin:ember/recommended" property in a configuration file enables this rule.

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() and dropAndThen() on the function calls that you're trying to bring into compliance with this rule