Skip to content

Commit

Permalink
Assert: Reset internal steps list after verifySteps
Browse files Browse the repository at this point in the history
  • Loading branch information
trentmwillis committed Nov 8, 2017
1 parent 9426505 commit 108e0df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Assert {
// Verifies the steps in a test match a given array of string values
verifySteps( steps, message ) {
this.deepEqual( this.test.steps, steps, message );
this.test.steps.length = 0;
}

// Specify the number of expected assertions to guarantee that failed test
Expand Down
17 changes: 16 additions & 1 deletion test/main/assert/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ QUnit.test( "pushes a passing assertion if a message is given", function( assert
QUnit.module( "assert.verifySteps" );

QUnit.test( "verifies the order and value of steps", function( assert ) {
assert.expect( 6 );
assert.expect( 10 );

assert.step( "One step" );
assert.step( "Two step" );
Expand All @@ -47,6 +47,11 @@ QUnit.test( "verifies the order and value of steps", function( assert ) {

assert.verifySteps( [ "One step", "Two step", "Red step", "Blue step" ] );

assert.step( "One step" );
assert.step( "Two step" );
assert.step( "Red step" );
assert.step( "Blue step" );

var originalPushResult = assert.pushResult;
assert.pushResult = function pushResultStub( resultInfo ) {
assert.pushResult = originalPushResult;
Expand All @@ -73,3 +78,13 @@ QUnit.test( "verifies the order and value of failed steps", function( assert ) {

assert.verifySteps( [ "One step", undefined, "", "Two step" ] );
} );

QUnit.test( "resets the step list after verification", function( assert ) {
assert.expect( 4 );

assert.step( "one" );
assert.verifySteps( [ "one" ] );

assert.step( "two" );
assert.verifySteps( [ "two" ] );
} );

0 comments on commit 108e0df

Please sign in to comment.