File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
chapter-09/todo_react_motion/test/todos Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ import * as actions from '../../src/todos/actions.js' ;
2
+ import * as actionTypes from '../../src/todos/actionTypes.js' ;
3
+
4
+ describe ( 'todos/actions' , ( ) => {
5
+ describe ( 'addTodo' , ( ) => {
6
+ const addTodo = actions . addTodo
7
+
8
+ it ( 'should create an action to add todo' , ( ) => {
9
+ const text = 'first todo' ;
10
+ const action = addTodo ( text ) ;
11
+
12
+ expect ( action . text ) . toBe ( text ) ;
13
+ expect ( action . completed ) . toBe ( false ) ;
14
+ expect ( action . type ) . toBe ( actionTypes . ADD_TODO ) ;
15
+ } ) ;
16
+
17
+ it ( 'should have different id for different actions' , ( ) => {
18
+ const text = 'first todo' ;
19
+ const action1 = addTodo ( text ) ;
20
+ const action2 = addTodo ( text ) ;
21
+
22
+ expect ( action1 . id !== action2 . id ) . toBe ( true ) ;
23
+ } ) ;
24
+ } ) ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments