You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`npx` command installs most recent stable version of CRA from npm. `--template` parameter points to this template, note that `cra-template-` prefix is omitted.
19
+
`npx` command installs the most recent stable version of CRA from npm.
20
+
21
+
`--template` parameter points to this template, note that `cra-template-` prefix is omitted.
16
22
17
23
## Motivation
18
24
19
-
You know the pain. You start a new project and need to configure it again and again. It needs routing, ok you setup Router, then you need Redux - ok, oh. Wait... All of these tools you get used to. Redux boilerplate is taking some much to type. I want just to focus on building amazing projects and not spending hours configuring tools. That's why I've created this template. It's for you to use.
25
+
You know the pain. You start a new project from scratch and need to configure it again and again. It needs routing, ok you setup Router, then you need Redux - ok, oh 😩Redux boilerplate is taking so much time to type. Wait... what if you could have all the tools you want just from the beginning? I want to focus on building amazing projects and not spending hours configuring. That's why I've created this template. It's here for you to use.
20
26
21
27
## Available Scripts
22
28
@@ -38,21 +44,21 @@ Due to CRA template limitations (we can change only `scripts` and `dependencies`
38
44
39
45
## Redux configuration
40
46
41
-
Template provides basic Redux configuration with [feature based](https://redux.js.org/style-guide/style-guide/#structure-files-as-feature-folders-or-ducks) folder structure. You can use [Redux devtools browser extension](http://extension.remotedev.io/). Sample feature included in `src/features` folder, note technology agnostic `features` folder name. Based on Redux maintainers recommendation.
47
+
The template provides basic Redux configuration with [feature based](https://redux.js.org/style-guide/style-guide/#structure-files-as-feature-folders-or-ducks) folder structure. You can use [Redux devtools browser extension](http://extension.remotedev.io/). Sample feature included in `src/features` folder, note technology agnostic `features` folder name. Based on Redux maintainers recommendation.
42
48
43
49
## Testing
44
50
45
-
Snapshot testing done with [Enzyme](https://airbnb.io/enzyme/).
51
+
Testing is done with [Enzyme](https://airbnb.io/enzyme/).
46
52
47
53
## [Prettier](https://prettier.io/)
48
54
49
55
I added `prettier` to force consistent formatting. Don't like trailing semicolons? Feel free to [tweak prettier rules](https://prettier.io/docs/en/configuration.html) inside `.prettierrc` file to match your code style.
50
56
51
57
## Eslint configurations
52
58
53
-
Template extends CRA eslint rules with custom set, tailored for reasonable and clean development process.
59
+
The template extends CRA ESLint rules with a custom set, tailored for the reasonable and clean development process.
54
60
55
-
Eslint rules are commented for your convenience feel free to tweak or remove them inside `.eslintrc`. No judgement.
61
+
Eslint rules are commented for your convenience feel free to tweak or remove them inside `.eslintrc`. No judgment.
// Add jest mock spy to watch for store.dispatch method. See https://jestjs.io/docs/en/jest-object#jestspyonobject-methodname for more info
18
+
jest.spyOn(store,'dispatch')
19
+
20
+
beforeEach(()=>{
21
+
// Clear any saved mock data from previous tests, because jest saves calls data for spies and mocks, https://jestjs.io/docs/en/mock-function-api#mockfnmockclear
22
+
store.dispatch.mockClear()
23
+
})
24
+
25
+
it('renders without crashing.',()=>{
26
+
constwrapper=mount(
27
+
<Providerstore={store}>
28
+
<Counter/>
29
+
</Provider>
30
+
)
31
+
32
+
constcountValue=wrapper.find('strong').text()
33
+
expect(countValue).toBe('42')
34
+
})
35
+
36
+
it('should be possible to increment counter.',()=>{
37
+
constwrapper=mount(
38
+
<Providerstore={store}>
39
+
<Counter/>
40
+
</Provider>
41
+
)
42
+
43
+
wrapper
44
+
.find('button')
45
+
.filter({'data-qa': 'increment-counter'})
46
+
.simulate('click')
47
+
48
+
expect(store.dispatch).toBeCalledTimes(1)
49
+
50
+
expect(store.dispatch).toBeCalledWith({
51
+
type: actionTypes.INCREMENT_COUNTER,
52
+
})
53
+
})
54
+
55
+
it('should be possible to decrement counter.',()=>{
0 commit comments