jest: deemphasize async
This commit is contained in:
parent
356719d5a7
commit
7fe5d5ccbd
40
jest.md
40
jest.md
|
@ -54,26 +54,6 @@ describe('My work', () => {
|
||||||
`it` is an alias for `test`.
|
`it` is an alias for `test`.
|
||||||
See: [test()](http://facebook.github.io/jest/docs/en/api.html#testname-fn)
|
See: [test()](http://facebook.github.io/jest/docs/en/api.html#testname-fn)
|
||||||
|
|
||||||
### Asynchronous tests
|
|
||||||
|
|
||||||
```js
|
|
||||||
test('works with promises', () => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
···
|
|
||||||
})
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
test('works with async/await', async () => {
|
|
||||||
const hello = await foo()
|
|
||||||
···
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Return promises, or use async/await.
|
|
||||||
See: [Async tutorial](http://facebook.github.io/jest/docs/en/tutorial-async.html)
|
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -199,6 +179,26 @@ expect.assertions(1)
|
||||||
More features
|
More features
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
### Asynchronous tests
|
||||||
|
|
||||||
|
```js
|
||||||
|
test('works with promises', () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
···
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
test('works with async/await', async () => {
|
||||||
|
const hello = await foo()
|
||||||
|
···
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Return promises, or use async/await.
|
||||||
|
See: [Async tutorial](http://facebook.github.io/jest/docs/en/tutorial-async.html)
|
||||||
|
|
||||||
### Snapshots
|
### Snapshots
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
|
|
Loading…
Reference in New Issue