mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
added more content to steps 2.4 and 2.5
This commit is contained in:
@@ -57,7 +57,7 @@ describe('TestMe Component', () => {
|
||||
|
||||
## Mocking
|
||||
|
||||
Mocking functions is a large part of what makes `jest` a powerful testing library. `jest` actually intercepts module inclusion process in `node.js` allowing it to mock entire modules if needed.
|
||||
Mocking functions is a large part of what makes `jest` a powerful testing library. `jest` actually intercepts module inclusion process in `node.js` allowing it to mock entire modules if needed. There are many ways to mock as you can imagine in a language as flexible as JS. We only look at the simplest case but there's a lot of depth here.
|
||||
|
||||
To mock a function:
|
||||
|
||||
@@ -78,7 +78,7 @@ Read more about jest mocking here: https://jestjs.io/docs/en/mock-functions.html
|
||||
|
||||
```ts
|
||||
it('tests callback functions', (done) => {
|
||||
someFunctionThatCallsbackWhend(done));
|
||||
someFunctionThatCallsDone(done));
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user