Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.34 KB

no-test-and-then.md

File metadata and controls

36 lines (25 loc) · 1.34 KB

ember/no-test-and-then

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