cheatsheets/qunit.md

47 lines
672 B
Markdown
Raw Permalink Normal View History

2014-09-30 04:04:13 +02:00
---
title: Qunit
2015-11-24 06:11:34 +01:00
category: JavaScript libraries
intro: |
A quick reference for the [QUnit](https://yarnpkg.com/package/qunit) testing library in JavaScript.
2014-09-30 04:04:13 +02:00
---
```js
QUnit.module('a')
QUnit.test('ok', function (t) {
/* ... */
})
```
2014-09-30 04:05:33 +02:00
### Hooks
#### Each test
2014-09-30 04:05:33 +02:00
```js
// each test
QUnit.testStart(function)
QUnit.testEnd(function)
```
2014-09-30 04:04:13 +02:00
```js
// each module
QUnit.moduleStart(function)
QUnit.moduleEnd(function)
```
2014-09-30 04:05:33 +02:00
```js
// all
QUnit.begin(function)
QUnit.done(function)
```
2014-09-30 04:04:13 +02:00
### Assertions
2014-09-30 04:04:13 +02:00
```js
t.equal(actual, expected)
t.deepEqual(actual, expected)
t.strictEqual(actual, expected)
t.propEqual(actual, expected)
t.notEqual(actual, expected)
t.expect(amount)
```