testdouble-qunit

Verify testdouble stubs with QUnit

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
testdouble-qunit
3.0.3a year ago5 years agoMinified + gzip package size for testdouble-qunit in KB

Readme

testdouble-qunit
CI
Verify testdoubletestdouble stubs with QUnitqunit

This library adds a assert.verify method to QUnit that allows you to verify that your stubs are called correctly.
test('the stub is called', function(assert) {
  const stub = td.function();

  stub('foo');

  assert.verify(stub('foo'));
});

The signature of assert.verify is the same as td.verify.

Installation

First, install the library. QUnitqunit and testdoubletestdouble must also be installed.
yarn add -D testdouble-qunit

In your test set-up code, you need to extend QUnit with the added verify assertion. You can do so with the following code snippet:
import QUnit from 'qunit';
import td from 'testdouble';
import installVerifyAssertion from 'testdouble-qunit';

installVerifyAssertion(QUnit, td);

If you are using this package with Ember.js, you should put this in your tests/test-helper.js file