From 1a4bd424b4d12eb2703427aaed7b884dd73852f1 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 31 Mar 2023 20:37:25 +0200 Subject: [PATCH] tests/qunit: Change assert.ok to assert.true Avoid loose assertion Change-Id: I6fd398ef2608c836fd59e0a48271f11c5e0d78a9 --- tests/qunit/CardModel.test.js | 2 +- tests/qunit/RelatedPagesGateway.test.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/qunit/CardModel.test.js b/tests/qunit/CardModel.test.js index fd9d8df1..d22401b9 100644 --- a/tests/qunit/CardModel.test.js +++ b/tests/qunit/CardModel.test.js @@ -19,7 +19,7 @@ model = new CardModel( {} ); model.on( 'change', function () { - assert.ok( false, 'It doesn\'t emit an event when silenced.' ); + assert.true( false, 'It doesn\'t emit an event when silenced.' ); } ); model.set( 'foo', 'bar', true ); diff --git a/tests/qunit/RelatedPagesGateway.test.js b/tests/qunit/RelatedPagesGateway.test.js index d806e608..7cb53762 100644 --- a/tests/qunit/RelatedPagesGateway.test.js +++ b/tests/qunit/RelatedPagesGateway.test.js @@ -32,7 +32,7 @@ this.sandbox.stub( this.api, 'get' ).returns( $.Deferred().resolve( relatedPages ) ); return gateway.getForCurrentPage( 1 ).then( function ( results ) { - assert.ok( Array.isArray( results ), 'Results must be an array' ); + assert.true( Array.isArray( results ), 'Results must be an array' ); assert.strictEqual( results[ 0 ].title, 'Oh noes' ); } ); } ); @@ -42,7 +42,7 @@ this.sandbox.stub( this.api, 'get' ).returns( $.Deferred().resolve( emptyRelatedPages ) ); return gateway.getForCurrentPage( 1 ).then( function ( results ) { - assert.ok( Array.isArray( results ), 'Results must be an array' ); + assert.true( Array.isArray( results ), 'Results must be an array' ); assert.strictEqual( results.length, 0 ); } ); } ); @@ -52,8 +52,8 @@ spy = this.sandbox.stub( this.api, 'get' ).returns( $.Deferred().resolve( relatedPages ) ); return gateway.getForCurrentPage( 1 ).then( function ( results ) { - assert.ok( Array.isArray( results ), 'Results must be an array' ); - assert.notOk( spy.called, 'API is not invoked' ); + assert.true( Array.isArray( results ), 'Results must be an array' ); + assert.false( spy.called, 'API is not invoked' ); assert.strictEqual( results.length, 0 ); } ); } ); @@ -97,7 +97,7 @@ .returns( $.Deferred().resolve( relatedPages ) ); return gateway.getForCurrentPage( 1 ).then( function ( results ) { - assert.ok( Array.isArray( results ), 'Results must be an array' ); + assert.true( Array.isArray( results ), 'Results must be an array' ); assert.strictEqual( results.length, 1, 'API is invoked to source articles.' ); } ); } );