@@ -67,9 +67,10 @@ describe('reducer', () => {
6767 } ) ) ;
6868 } ) ;
6969
70- it ( 'handles VOTE by setting hasVoted ' , ( ) => {
70+ it ( 'handles VOTE by setting myVote ' , ( ) => {
7171 const state = fromJS ( {
7272 vote : {
73+ round : 42 ,
7374 pair : [ 'Trainspotting' , '28 Days Later' ] ,
7475 tally : { Trainspotting : 1 }
7576 }
@@ -79,16 +80,21 @@ describe('reducer', () => {
7980
8081 expect ( nextState ) . to . equal ( fromJS ( {
8182 vote : {
83+ round : 42 ,
8284 pair : [ 'Trainspotting' , '28 Days Later' ] ,
8385 tally : { Trainspotting : 1 }
8486 } ,
85- hasVoted : 'Trainspotting'
87+ myVote : {
88+ round : 42 ,
89+ entry : 'Trainspotting'
90+ }
8691 } ) ) ;
8792 } ) ;
8893
89- it ( 'does not set hasVoted for VOTE on invalid entry' , ( ) => {
94+ it ( 'does not set myVote for VOTE on invalid entry' , ( ) => {
9095 const state = fromJS ( {
9196 vote : {
97+ round : 42 ,
9298 pair : [ 'Trainspotting' , '28 Days Later' ] ,
9399 tally : { Trainspotting : 1 }
94100 }
@@ -98,33 +104,40 @@ describe('reducer', () => {
98104
99105 expect ( nextState ) . to . equal ( fromJS ( {
100106 vote : {
107+ round : 42 ,
101108 pair : [ 'Trainspotting' , '28 Days Later' ] ,
102109 tally : { Trainspotting : 1 }
103110 }
104111 } ) ) ;
105112 } ) ;
106113
107- it ( 'removes hasVoted on SET_STATE if pair changes ' , ( ) => {
114+ it ( 'removes myVote on SET_STATE if round has changed ' , ( ) => {
108115 const initialState = fromJS ( {
109116 vote : {
117+ round : 42 ,
110118 pair : [ 'Trainspotting' , '28 Days Later' ] ,
111119 tally : { Trainspotting : 1 }
112120 } ,
113- hasVoted : 'Trainspotting'
121+ myVote : {
122+ round : 42 ,
123+ entry : 'Trainspotting'
124+ }
114125 } ) ;
115126 const action = {
116127 type : 'SET_STATE' ,
117128 state : {
118129 vote : {
119- pair : [ 'Sunshine' , 'Slumdog Millionaire' ]
130+ round : 43 ,
131+ pair : [ 'Sunshine' , 'Trainspotting' ]
120132 }
121133 }
122134 } ;
123135 const nextState = reducer ( initialState , action ) ;
124136
125137 expect ( nextState ) . to . equal ( fromJS ( {
126138 vote : {
127- pair : [ 'Sunshine' , 'Slumdog Millionaire' ]
139+ round : 43 ,
140+ pair : [ 'Sunshine' , 'Trainspotting' ]
128141 }
129142 } ) ) ;
130143 } ) ;
0 commit comments