Skip to content

Commit 0f6d30c

Browse files
committed
Testing docs update.
1 parent 03b4743 commit 0f6d30c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/src/docs/08-testing.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ section: "Guide"
55

66
# Testing
77

8-
The most valuable and easy to write tests for NuclearJS are unit tests. **The unit in Nuclear is the action.** The key assertion we want to make
8+
The most valuable and easy to write tests for NuclearJS are unit tests. **The unit in NuclearJS is the action.** The key assertion we want to make
99
is that a particular action or set of actions properly transforms the Reactor from **State A** to **State B**.
1010

1111
This is done by setting up the reactor with the proper state, using actions, executing the action under test and asserting proper state via **Getters**.
1212

1313
## Example
1414

15-
In our testing example we will test our Project module while contains two stores, the `currentProjectIdStore` and the `projectStore` as well as
15+
In our testing example we will test our Project module which contains two stores, the `currentProjectIdStore` and the `projectStore` as well as
1616
actions and getters.
1717

1818
#### `index.js`
@@ -126,16 +126,16 @@ export default { projectsMap, currentProject, currentProjectId }
126126

127127
Given our module we want to test the following:
128128

129-
- Using `actions.setCurrentProjectId()` sets the correct id using the `currentProjectId` getter
129+
- Using `actions.setCurrentProjectId()` sets the correct id using the `currentProjectId` getter.
130130

131-
- When `Api.fetchProducts` is stubbed with mock data, calling `actions.fetchProjects` properly poulates
132-
the projects store by using the `projectsMap` getter
131+
- When `Api.fetchProducts` is stubbed with mock data, calling `actions.fetchProjects` properly populates
132+
the projects store by using the `projectsMap` getter.
133133

134-
- When projects have been loaded and currentProjectId set, `currentProject` getter works
134+
- When projects have been loaded and currentProjectId set, `currentProject` getter works.
135135

136136
**Testing Tools**
137137

138-
We will use the following tools: mocha, sinon, expect.js. The same testing ideas can be implemented with a variety of tools.
138+
We will use the following tools: **mocha**, **sinon**, and **expect.js**. The same testing ideas can be implemented with a variety of tools.
139139

140140
#### `tests.js`
141141

@@ -159,7 +159,7 @@ describe('modules/Project', () => {
159159

160160
describe('actions', () => {
161161
describe('#setCurrentProjectId', () => {
162-
it("should set the current project id", () => {
162+
it('should set the current project id', () => {
163163
Project.actions.setCurrentProjectId('123-abc')
164164

165165
expect(flux.evaluate(Project.getters.currentProjectId)).to.be('123-abc')
@@ -227,10 +227,10 @@ describe('modules/Project', () => {
227227

228228
## Recap
229229

230-
When testing NuclearJS code it makes sense to test around actions asserting proper state updates via getters. While these tests may seem simple, they are
231-
testing that our stores, actions and getters are all working in a cohesive manner. As your codebase scales out these tests be the foundation of unit tests
232-
for all data flow and state logic.
230+
When testing NuclearJS code it makes sense to test around actions by asserting proper state updates via getters. While these tests may seem simple, they are
231+
testing that our stores, actions and getters are all working together in a cohesive manner. As your codebase scales, these tests can be the foundation of unit tests
232+
for all your data flow and state logic.
233233

234234
Another thing to note is that we did not stub or mock any part of the NuclearJS system. While testing in isolation is good for a variety of reasons,
235235
isolating too much will cause your tests to be unrealistic and more prone to breakage after refactoring. By testing the entire module as a unit
236-
we are able to keep the test high level with limited stubs.
236+
you are able to keep the test high level with limited stubs.

0 commit comments

Comments
 (0)