@@ -34,7 +34,10 @@ describe('sectionComments reducer', () => {
3434 const results = [ makeComment ( { id : 1 } ) , makeComment ( { id : 2 } ) ] ;
3535 store . dispatch ( {
3636 type : 'receiveSectionComments' ,
37- payload : { sectionId : SECTION_ID , data : { count : 2 , results, next : null } } ,
37+ payload : {
38+ sectionId : SECTION_ID ,
39+ data : { count : 2 , results, next : null } ,
40+ } ,
3841 } ) ;
3942 const state = store . getState ( ) [ SECTION_ID ] ;
4043 expect ( state . isFetching ) . toBe ( false ) ;
@@ -45,19 +48,21 @@ describe('sectionComments reducer', () => {
4548
4649 it ( 'appends paginated results to existing results' , ( ) => {
4750 const existing = [ makeComment ( { id : 1 } ) ] ;
48- const store = makeStore ( { [ SECTION_ID ] : { results : existing , count : 1 , isFetching : true } } ) ;
51+ const store = makeStore ( {
52+ [ SECTION_ID ] : { results : existing , count : 1 , isFetching : true } ,
53+ } ) ;
4954 const incoming = [ makeComment ( { id : 2 } ) , makeComment ( { id : 3 } ) ] ;
5055 store . dispatch ( {
5156 type : 'receiveSectionComments' ,
5257 payload : {
5358 sectionId : SECTION_ID ,
54- data : { count : 3 , results : incoming , next : 'http ://next-page' } ,
59+ data : { count : 3 , results : incoming , next : 'https ://next-page' } ,
5560 } ,
5661 } ) ;
5762 const state = store . getState ( ) [ SECTION_ID ] ;
5863 expect ( state . isFetching ) . toBe ( false ) ;
5964 expect ( state . count ) . toBe ( 3 ) ;
60- expect ( state . next ) . toBe ( 'http ://next-page' ) ;
65+ expect ( state . next ) . toBe ( 'https ://next-page' ) ;
6166 expect ( state . results ) . toHaveLength ( 3 ) ;
6267 expect ( state . results [ 0 ] . id ) . toBe ( 1 ) ;
6368 expect ( state . results [ 1 ] . id ) . toBe ( 2 ) ;
@@ -87,7 +92,11 @@ describe('sectionComments reducer', () => {
8792 } ) ;
8893 store . dispatch ( {
8994 type : 'beginFetchSectionComments' ,
90- payload : { sectionId : SECTION_ID , ordering : '-created_at' , cleanFetch : false } ,
95+ payload : {
96+ sectionId : SECTION_ID ,
97+ ordering : '-created_at' ,
98+ cleanFetch : false ,
99+ } ,
91100 } ) ;
92101 const state = store . getState ( ) [ SECTION_ID ] ;
93102 expect ( state . isFetching ) . toBe ( true ) ;
@@ -97,11 +106,19 @@ describe('sectionComments reducer', () => {
97106
98107 it ( 'clears results when ordering differs' , ( ) => {
99108 const store = makeStore ( {
100- [ SECTION_ID ] : { results : [ makeComment ( ) ] , ordering : '-created_at' , isFetching : false } ,
109+ [ SECTION_ID ] : {
110+ results : [ makeComment ( ) ] ,
111+ ordering : '-created_at' ,
112+ isFetching : false ,
113+ } ,
101114 } ) ;
102115 store . dispatch ( {
103116 type : 'beginFetchSectionComments' ,
104- payload : { sectionId : SECTION_ID , ordering : 'created_at' , cleanFetch : false } ,
117+ payload : {
118+ sectionId : SECTION_ID ,
119+ ordering : 'created_at' ,
120+ cleanFetch : false ,
121+ } ,
105122 } ) ;
106123 const state = store . getState ( ) [ SECTION_ID ] ;
107124 expect ( state . isFetching ) . toBe ( true ) ;
@@ -111,11 +128,19 @@ describe('sectionComments reducer', () => {
111128
112129 it ( 'clears results when cleanFetch is true regardless of ordering' , ( ) => {
113130 const store = makeStore ( {
114- [ SECTION_ID ] : { results : [ makeComment ( ) ] , ordering : '-created_at' , isFetching : false } ,
131+ [ SECTION_ID ] : {
132+ results : [ makeComment ( ) ] ,
133+ ordering : '-created_at' ,
134+ isFetching : false ,
135+ } ,
115136 } ) ;
116137 store . dispatch ( {
117138 type : 'beginFetchSectionComments' ,
118- payload : { sectionId : SECTION_ID , ordering : '-created_at' , cleanFetch : true } ,
139+ payload : {
140+ sectionId : SECTION_ID ,
141+ ordering : '-created_at' ,
142+ cleanFetch : true ,
143+ } ,
119144 } ) ;
120145 const state = store . getState ( ) [ SECTION_ID ] ;
121146 expect ( state . isFetching ) . toBe ( true ) ;
@@ -126,7 +151,11 @@ describe('sectionComments reducer', () => {
126151 describe ( 'postedComment' , ( ) => {
127152 it ( 'resets results, sets jumpTo and ordering' , ( ) => {
128153 const store = makeStore ( {
129- [ SECTION_ID ] : { results : [ makeComment ( ) ] , count : 1 , ordering : 'created_at' } ,
154+ [ SECTION_ID ] : {
155+ results : [ makeComment ( ) ] ,
156+ count : 1 ,
157+ ordering : 'created_at' ,
158+ } ,
130159 } ) ;
131160 store . dispatch ( {
132161 type : 'postedComment' ,
@@ -141,11 +170,17 @@ describe('sectionComments reducer', () => {
141170
142171 describe ( 'editedComment' , ( ) => {
143172 it ( 'updates a top-level comment in-place' , ( ) => {
144- const comments = [ makeComment ( { id : 1 , content : 'Original' } ) , makeComment ( { id : 2 } ) ] ;
173+ const comments = [
174+ makeComment ( { id : 1 , content : 'Original' } ) ,
175+ makeComment ( { id : 2 } ) ,
176+ ] ;
145177 const store = makeStore ( { [ SECTION_ID ] : { results : comments } } ) ;
146178 store . dispatch ( {
147179 type : 'editedComment' ,
148- payload : { sectionId : SECTION_ID , comment : { id : 1 , content : 'Updated' } } ,
180+ payload : {
181+ sectionId : SECTION_ID ,
182+ comment : { id : 1 , content : 'Updated' } ,
183+ } ,
149184 } ) ;
150185 const state = store . getState ( ) [ SECTION_ID ] ;
151186 expect ( state . results [ 0 ] . content ) . toBe ( 'Updated' ) ;
@@ -155,7 +190,10 @@ describe('sectionComments reducer', () => {
155190
156191 describe ( 'postedCommentVote' , ( ) => {
157192 it ( 'increments n_votes on the target comment' , ( ) => {
158- const comments = [ makeComment ( { id : 1 , n_votes : 3 } ) , makeComment ( { id : 2 , n_votes : 0 } ) ] ;
193+ const comments = [
194+ makeComment ( { id : 1 , n_votes : 3 } ) ,
195+ makeComment ( { id : 2 , n_votes : 0 } ) ,
196+ ] ;
159197 const store = makeStore ( { [ SECTION_ID ] : { results : comments } } ) ;
160198 store . dispatch ( {
161199 type : 'postedCommentVote' ,
@@ -167,7 +205,9 @@ describe('sectionComments reducer', () => {
167205 } ) ;
168206
169207 it ( 'persists voted comment id to localStorage' , ( ) => {
170- const store = makeStore ( { [ SECTION_ID ] : { results : [ makeComment ( { id : 7 } ) ] } } ) ;
208+ const store = makeStore ( {
209+ [ SECTION_ID ] : { results : [ makeComment ( { id : 7 } ) ] } ,
210+ } ) ;
171211 store . dispatch ( {
172212 type : 'postedCommentVote' ,
173213 payload : { commentId : 7 , sectionId : SECTION_ID , isReply : false } ,
@@ -179,7 +219,10 @@ describe('sectionComments reducer', () => {
179219
180220 describe ( 'postedCommentFlag' , ( ) => {
181221 it ( 'sets flagged to true on the target comment' , ( ) => {
182- const comments = [ makeComment ( { id : 1 , flagged : false } ) , makeComment ( { id : 2 , flagged : false } ) ] ;
222+ const comments = [
223+ makeComment ( { id : 1 , flagged : false } ) ,
224+ makeComment ( { id : 2 , flagged : false } ) ,
225+ ] ;
183226 const store = makeStore ( { [ SECTION_ID ] : { results : comments } } ) ;
184227 store . dispatch ( {
185228 type : 'postedCommentFlag' ,
@@ -193,7 +236,9 @@ describe('sectionComments reducer', () => {
193236
194237 describe ( 'receiveSectionCommentsError' , ( ) => {
195238 it ( 'sets isFetching to false' , ( ) => {
196- const store = makeStore ( { [ SECTION_ID ] : { isFetching : true , results : [ makeComment ( ) ] } } ) ;
239+ const store = makeStore ( {
240+ [ SECTION_ID ] : { isFetching : true , results : [ makeComment ( ) ] } ,
241+ } ) ;
197242 store . dispatch ( {
198243 type : 'receiveSectionCommentsError' ,
199244 payload : { sectionId : SECTION_ID } ,
0 commit comments