Skip to content

Commit 57a6d3a

Browse files
committed
Merge pull request reduxjs#917 from dguo/patch-1
Fix typos in WritingTests.md
2 parents d8f3567 + 6d070b1 commit 57a6d3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/recipes/WritingTests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Writing Tests
22

3-
Because most of the Redux code you write are functions, and many of them are pure, they are easy test without mocking.
3+
Because most of the Redux code you write are functions, and many of them are pure, they are easy to test without mocking.
44

55
### Setting Up
66

77
We recommend [Mocha](http://mochajs.org/) as the testing engine.
8-
Note that it runs in a Node environment, so you won’t have access to DOM.
8+
Note that it runs in a Node environment, so you won’t have access to the DOM.
99

1010
```
1111
npm install --save-dev mocha
@@ -349,7 +349,7 @@ describe('components', () => {
349349

350350
#### Fixing Broken `setState()`
351351

352-
Shallow rendering currently [throws an error if `setState` is called](https://github.com/facebook/react/issues/4019). React seems to expect that, if you use `setState`, DOM is available. To work around the issue, we use jsdom so React doesn’t throw the exception when DOM isn’t available. Here’s how to [set it up](https://github.com/facebook/react/issues/5046#issuecomment-146222515):
352+
Shallow rendering currently [throws an error if `setState` is called](https://github.com/facebook/react/issues/4019). React seems to expect that, if you use `setState`, the DOM is available. To work around the issue, we use jsdom so React doesn’t throw the exception when the DOM isn’t available. Here’s how to [set it up](https://github.com/facebook/react/issues/5046#issuecomment-146222515):
353353

354354
```
355355
npm install --save-dev jsdom
@@ -398,7 +398,7 @@ In a unit test, you would normally import the `App` component like this:
398398
import App from './App';
399399
```
400400

401-
However when you import it, you’re actually holding the wrapper component returned by `connect()`, and not the `App` component itself. If you want to test its interaction with Redux, this is good news: you can wrap it in a [`<Provider>`](https://github.com/rackt/react-redux#provider-store) with a store created specifically for this unit test. But sometimes you want to test just the rendering of the component, without a Redux store.
401+
However, when you import it, you’re actually holding the wrapper component returned by `connect()`, and not the `App` component itself. If you want to test its interaction with Redux, this is good news: you can wrap it in a [`<Provider>`](https://github.com/rackt/react-redux#provider-store) with a store created specifically for this unit test. But sometimes you want to test just the rendering of the component, without a Redux store.
402402

403403
In order to be able to test the App component itself without having to deal with the decorator, we recommend you to also export the undecorated component:
404404

0 commit comments

Comments
 (0)