@@ -67,9 +67,10 @@ describe('reducer', () => {
67
67
} ) ) ;
68
68
} ) ;
69
69
70
- it ( 'handles VOTE by setting hasVoted ' , ( ) => {
70
+ it ( 'handles VOTE by setting myVote ' , ( ) => {
71
71
const state = fromJS ( {
72
72
vote : {
73
+ round : 42 ,
73
74
pair : [ 'Trainspotting' , '28 Days Later' ] ,
74
75
tally : { Trainspotting : 1 }
75
76
}
@@ -79,16 +80,21 @@ describe('reducer', () => {
79
80
80
81
expect ( nextState ) . to . equal ( fromJS ( {
81
82
vote : {
83
+ round : 42 ,
82
84
pair : [ 'Trainspotting' , '28 Days Later' ] ,
83
85
tally : { Trainspotting : 1 }
84
86
} ,
85
- hasVoted : 'Trainspotting'
87
+ myVote : {
88
+ round : 42 ,
89
+ entry : 'Trainspotting'
90
+ }
86
91
} ) ) ;
87
92
} ) ;
88
93
89
- it ( 'does not set hasVoted for VOTE on invalid entry' , ( ) => {
94
+ it ( 'does not set myVote for VOTE on invalid entry' , ( ) => {
90
95
const state = fromJS ( {
91
96
vote : {
97
+ round : 42 ,
92
98
pair : [ 'Trainspotting' , '28 Days Later' ] ,
93
99
tally : { Trainspotting : 1 }
94
100
}
@@ -98,33 +104,40 @@ describe('reducer', () => {
98
104
99
105
expect ( nextState ) . to . equal ( fromJS ( {
100
106
vote : {
107
+ round : 42 ,
101
108
pair : [ 'Trainspotting' , '28 Days Later' ] ,
102
109
tally : { Trainspotting : 1 }
103
110
}
104
111
} ) ) ;
105
112
} ) ;
106
113
107
- it ( 'removes hasVoted on SET_STATE if pair changes ' , ( ) => {
114
+ it ( 'removes myVote on SET_STATE if round has changed ' , ( ) => {
108
115
const initialState = fromJS ( {
109
116
vote : {
117
+ round : 42 ,
110
118
pair : [ 'Trainspotting' , '28 Days Later' ] ,
111
119
tally : { Trainspotting : 1 }
112
120
} ,
113
- hasVoted : 'Trainspotting'
121
+ myVote : {
122
+ round : 42 ,
123
+ entry : 'Trainspotting'
124
+ }
114
125
} ) ;
115
126
const action = {
116
127
type : 'SET_STATE' ,
117
128
state : {
118
129
vote : {
119
- pair : [ 'Sunshine' , 'Slumdog Millionaire' ]
130
+ round : 43 ,
131
+ pair : [ 'Sunshine' , 'Trainspotting' ]
120
132
}
121
133
}
122
134
} ;
123
135
const nextState = reducer ( initialState , action ) ;
124
136
125
137
expect ( nextState ) . to . equal ( fromJS ( {
126
138
vote : {
127
- pair : [ 'Sunshine' , 'Slumdog Millionaire' ]
139
+ round : 43 ,
140
+ pair : [ 'Sunshine' , 'Trainspotting' ]
128
141
}
129
142
} ) ) ;
130
143
} ) ;
0 commit comments