Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Latest commit

 

History

History
45 lines (35 loc) · 1.14 KB

File metadata and controls

45 lines (35 loc) · 1.14 KB
layout page-api
title assert.step()
excerpt Record a step for later verification.
groups
assert
redirect_from
/assert/step/
version_added 2.2.0

step( value )

Record a step for later verification.

name description
value (string) Relevant string value, or short description, to mark this step.

This assertion registers a passing assertion with the provided string. This and any other steps should be verified later in the test via assert.verifySteps().

The Step API provides an easy way to verify execution logic to a high degree of accuracy and precision, whether for asynchronous code, event-driven code, or callback-driven code.

Examples

QUnit.test('example', function (assert) {
  var maker = new WordMaker();
  maker.on('start', () => {
    assert.step('start');
  });
  maker.on('data', (word) => {
    assert.step(word);
  });
  maker.on('end', () => {
    assert.step('end');
  });

  maker.process('3.1');

  assert.verifySteps([ 'start', '3', 'point', '1', 'end' ]);
});

Note: See assert.verifySteps() for more detailed examples.