https://github.com/alexlafroscia/testdouble-qunit
Verify testdouble stubs with QUnit
https://github.com/alexlafroscia/testdouble-qunit
qunit stubs testdouble verify
Last synced: about 2 months ago
JSON representation
Verify testdouble stubs with QUnit
- Host: GitHub
- URL: https://github.com/alexlafroscia/testdouble-qunit
- Owner: alexlafroscia
- License: mit
- Created: 2018-03-28T06:40:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-12-30T04:51:29.000Z (10 months ago)
- Last Synced: 2025-01-03T07:45:56.809Z (9 months ago)
- Topics: qunit, stubs, testdouble, verify
- Language: TypeScript
- Homepage: https://alexlafroscia.github.io/testdouble-qunit
- Size: 2.09 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# testdouble-qunit
[](https://github.com/alexlafroscia/testdouble-qunit/actions?query=workflow%3ACI)
> Verify [`testdouble`][testdouble] stubs with [`QUnit`][qunit]
This library adds a `assert.verify` method to `QUnit` that allows you to verify that your stubs are called correctly.
```javascript
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. [`QUnit`][qunit] and [`testdouble`][testdouble] must also be installed.
```bash
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:
```javascript
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
[testdouble]: https://github.com/testdouble/testdouble.js/
[qunit]: https://qunitjs.com