1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2026-01-13 14:32:03 +01:00
cheatsheets/qunit.md
Rico Sta. Cruz 511de900ba
Formatting updates (#2133)
- Update some sheets which have very long sections
- Remove `layout: 2017/sheet` (everything has the same layout now)
- Remove outdated sheets
2024-04-03 18:30:24 +11:00

47 lines
672 B
Markdown

---
title: Qunit
category: JavaScript libraries
intro: |
A quick reference for the [QUnit](https://yarnpkg.com/package/qunit) testing library in JavaScript.
---
```js
QUnit.module('a')
QUnit.test('ok', function (t) {
/* ... */
})
```
### Hooks
#### Each test
```js
// each test
QUnit.testStart(function)
QUnit.testEnd(function)
```
```js
// each module
QUnit.moduleStart(function)
QUnit.moduleEnd(function)
```
```js
// all
QUnit.begin(function)
QUnit.done(function)
```
### Assertions
```js
t.equal(actual, expected)
t.deepEqual(actual, expected)
t.strictEqual(actual, expected)
t.propEqual(actual, expected)
t.notEqual(actual, expected)
t.expect(amount)
```