@@ -190,18 +190,18 @@ describe('parse', () => {
190190 it ( 'happy path' , ( ) => {
191191 // arrange:
192192 let msgNum = 0 ;
193- const next = parse . getMessages ( id => {
194- expect ( id ) . toEqual ( 'abc' ) ;
195- } , retry => {
196- expect ( retry ) . toEqual ( 42 ) ;
197- } , msg => {
193+ const next = parse . getMessages ( msg => {
198194 ++ msgNum ;
199195 expect ( msg ) . toEqual ( {
200196 retry : 42 ,
201197 id : 'abc' ,
202198 event : 'def' ,
203199 data : 'ghi'
204200 } ) ;
201+ } , id => {
202+ expect ( id ) . toEqual ( 'abc' ) ;
203+ } , retry => {
204+ expect ( retry ) . toEqual ( 42 ) ;
205205 } ) ;
206206
207207 // act:
@@ -217,18 +217,18 @@ describe('parse', () => {
217217
218218 it ( 'skip unknown fields' , ( ) => {
219219 let msgNum = 0 ;
220- const next = parse . getMessages ( id => {
221- expect ( id ) . toEqual ( 'abc' ) ;
222- } , _retry => {
223- fail ( 'retry should not be called' ) ;
224- } , msg => {
220+ const next = parse . getMessages ( msg => {
225221 ++ msgNum ;
226222 expect ( msg ) . toEqual ( {
227223 id : 'abc' ,
228224 data : '' ,
229225 event : '' ,
230226 retry : undefined ,
231227 } ) ;
228+ } , id => {
229+ expect ( id ) . toEqual ( 'abc' ) ;
230+ } , _retry => {
231+ fail ( 'retry should not be called' ) ;
232232 } ) ;
233233
234234 // act:
@@ -242,18 +242,18 @@ describe('parse', () => {
242242
243243 it ( 'ignore non-integer retry' , ( ) => {
244244 let msgNum = 0 ;
245- const next = parse . getMessages ( _id => {
246- fail ( 'id should not be called' ) ;
247- } , _retry => {
248- fail ( 'retry should not be called' ) ;
249- } , msg => {
245+ const next = parse . getMessages ( msg => {
250246 ++ msgNum ;
251247 expect ( msg ) . toEqual ( {
252248 id : '' ,
253249 data : '' ,
254250 event : '' ,
255251 retry : undefined ,
256252 } ) ;
253+ } , _id => {
254+ fail ( 'id should not be called' ) ;
255+ } , _retry => {
256+ fail ( 'retry should not be called' ) ;
257257 } ) ;
258258
259259 // act:
@@ -267,18 +267,18 @@ describe('parse', () => {
267267 it ( 'skip comment-only messages' , ( ) => {
268268 // arrange:
269269 let msgNum = 0 ;
270- const next = parse . getMessages ( id => {
271- expect ( id ) . toEqual ( '123' ) ;
272- } , _retry => {
273- fail ( 'retry should not be called' ) ;
274- } , msg => {
270+ const next = parse . getMessages ( msg => {
275271 ++ msgNum ;
276272 expect ( msg ) . toEqual ( {
277273 retry : undefined ,
278274 id : '123' ,
279275 event : 'foo ' ,
280276 data : '' ,
281277 } ) ;
278+ } , id => {
279+ expect ( id ) . toEqual ( '123' ) ;
280+ } , _retry => {
281+ fail ( 'retry should not be called' ) ;
282282 } ) ;
283283
284284 // act:
@@ -295,18 +295,18 @@ describe('parse', () => {
295295 it ( 'should append data split across multiple lines' , ( ) => {
296296 // arrange:
297297 let msgNum = 0 ;
298- const next = parse . getMessages ( _id => {
299- fail ( 'id should not be called' ) ;
300- } , _retry => {
301- fail ( 'retry should not be called' ) ;
302- } , msg => {
298+ const next = parse . getMessages ( msg => {
303299 ++ msgNum ;
304300 expect ( msg ) . toEqual ( {
305301 data : 'YHOO\n+2\n\n10' ,
306302 id : '' ,
307303 event : '' ,
308304 retry : undefined ,
309305 } ) ;
306+ } , _id => {
307+ fail ( 'id should not be called' ) ;
308+ } , _retry => {
309+ fail ( 'retry should not be called' ) ;
310310 } ) ;
311311
312312 // act:
@@ -325,19 +325,19 @@ describe('parse', () => {
325325 const expectedIds = [ 'foo' , '' ] ;
326326 let idsIdx = 0 ;
327327 let msgNum = 0 ;
328- const next = parse . getMessages ( id => {
329- expect ( id ) . toEqual ( expectedIds [ idsIdx ] ) ;
330- ++ idsIdx ;
331- } , _retry => {
332- fail ( 'retry should not be called' ) ;
333- } , msg => {
328+ const next = parse . getMessages ( msg => {
334329 ++ msgNum ;
335330 expect ( msg ) . toEqual ( {
336331 data : '' ,
337332 id : '' ,
338333 event : '' ,
339334 retry : undefined ,
340335 } ) ;
336+ } , id => {
337+ expect ( id ) . toEqual ( expectedIds [ idsIdx ] ) ;
338+ ++ idsIdx ;
339+ } , _retry => {
340+ fail ( 'retry should not be called' ) ;
341341 } ) ;
342342
343343 // act:
0 commit comments