mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-06-16 18:39:21 +08:00
committed by
Joe Haddad
parent
d6781afd10
commit
c7d6a5de34
@@ -884,8 +884,8 @@ it('sums numbers', () => {
|
||||
});
|
||||
```
|
||||
|
||||
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).<br>
|
||||
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/api.html#tobecalled) to create “spies” or mock functions.
|
||||
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/expect.html).<br>
|
||||
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/expect.html#tohavebeencalled) to create “spies” or mock functions.
|
||||
|
||||
### Testing Components
|
||||
|
||||
@@ -943,7 +943,7 @@ it('renders welcome message', () => {
|
||||
});
|
||||
```
|
||||
|
||||
All Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).<br>
|
||||
All Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/expect.html).<br>
|
||||
Nevertheless you can use a third-party assertion library like [Chai](http://chaijs.com/) if you want to, as described below.
|
||||
|
||||
Additionally, you might find [jest-enzyme](https://github.com/blainekasten/enzyme-matchers) helpful to simplify your tests with readable matchers. The above `contains` code can be written simpler with jest-enzyme.
|
||||
|
||||
Reference in New Issue
Block a user