Skip to content

Commit 9d52744

Browse files
committed
Add tests for new instructions reducer logic
1 parent 1c958f7 commit 9d52744

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

test/unit/reducers/projects.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
unhideComponent,
2222
toggleComponent,
2323
updateProjectSource,
24+
updateProjectInstructions,
2425
} from '../../../src/actions/projects';
2526
import {
2627
snapshotImported,
@@ -65,6 +66,17 @@ test('updateProjectSource', reducerTest(
6566
),
6667
));
6768

69+
tap(initProjects({1: false}), projects =>
70+
test('updateProjectInstructions', reducerTest(
71+
reducer,
72+
projects,
73+
partial(updateProjectInstructions, '1', '# Instructions\n\nHello.'),
74+
projects.update('1', projectIn =>
75+
projectIn.set('instructions', '# Instructions\n\nHello.'),
76+
),
77+
)),
78+
);
79+
6880
test('changeCurrentProject', (t) => {
6981
t.test('from modified to pristine', reducerTest(
7082
reducer,

test/unit/reducers/ui.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
gistNotFound,
99
gistImportError,
1010
updateProjectSource,
11+
updateProjectInstructions,
1112
} from '../../../src/actions/projects';
1213
import {
1314
dragColumnDivider,
@@ -18,6 +19,8 @@ import {
1819
notificationTriggered,
1920
userDismissedNotification,
2021
toggleTopBarMenu,
22+
startEditingInstructions,
23+
stopEditingInstructions,
2124
} from '../../../src/actions/ui';
2225
import {
2326
snapshotCreated,
@@ -124,6 +127,27 @@ test('dragRowDivider', (t) => {
124127
));
125128
});
126129

130+
test('startEditingInstructions', reducerTest(
131+
reducer,
132+
initialState,
133+
startEditingInstructions,
134+
initialState.setIn(['workspace', 'isEditingInstructions'], true),
135+
));
136+
137+
test('startEditingInstructions', reducerTest(
138+
reducer,
139+
initialState.setIn(['workspace', 'isEditingInstructions'], true),
140+
stopEditingInstructions,
141+
initialState,
142+
));
143+
144+
test('updateProjectInstructions', reducerTest(
145+
reducer,
146+
initialState.setIn(['workspace', 'isEditingInstructions'], true),
147+
updateProjectInstructions,
148+
initialState,
149+
));
150+
127151
test('gistNotFound', reducerTest(
128152
reducer,
129153
initialState,

0 commit comments

Comments
 (0)