@@ -107,7 +107,7 @@ const createTestTransport = (...sendResults: MockResult<TransportMakeRequestResp
107
107
} ;
108
108
} ;
109
109
110
- type StoreEvents = ( 'push' | 'unshift' | 'pop ' ) [ ] ;
110
+ type StoreEvents = ( 'push' | 'unshift' | 'shift ' ) [ ] ;
111
111
112
112
function createTestStore ( ...popResults : MockResult < Envelope | undefined > [ ] ) : {
113
113
getCalls : ( ) => StoreEvents ;
@@ -130,8 +130,8 @@ function createTestStore(...popResults: MockResult<Envelope | undefined>[]): {
130
130
calls . push ( 'unshift' ) ;
131
131
}
132
132
} ,
133
- pop : async ( ) => {
134
- calls . push ( 'pop ' ) ;
133
+ shift : async ( ) => {
134
+ calls . push ( 'shift ' ) ;
135
135
const next = popResults . shift ( ) ;
136
136
137
137
if ( next instanceof Error ) {
@@ -182,7 +182,7 @@ describe('makeOfflineTransport', () => {
182
182
await waitUntil ( ( ) => getCalls ( ) . length == 1 , 1_000 ) ;
183
183
184
184
// After a successful send, the store should be checked
185
- expect ( getCalls ( ) ) . toEqual ( [ 'pop ' ] ) ;
185
+ expect ( getCalls ( ) ) . toEqual ( [ 'shift ' ] ) ;
186
186
} ) ;
187
187
188
188
it ( 'Envelopes are added after existing envelopes in the queue' , async ( ) => {
@@ -197,7 +197,7 @@ describe('makeOfflineTransport', () => {
197
197
198
198
expect ( getSendCount ( ) ) . toEqual ( 2 ) ;
199
199
// After a successful send from the store, the store should be checked again to ensure it's empty
200
- expect ( getCalls ( ) ) . toEqual ( [ 'pop ' , 'pop ' ] ) ;
200
+ expect ( getCalls ( ) ) . toEqual ( [ 'shift ' , 'shift ' ] ) ;
201
201
} ) ;
202
202
203
203
it ( 'Queues envelope if wrapped transport throws error' , async ( ) => {
@@ -259,7 +259,7 @@ describe('makeOfflineTransport', () => {
259
259
await waitUntil ( ( ) => getCalls ( ) . length === 3 && getSendCount ( ) === 1 , START_DELAY * 2 ) ;
260
260
261
261
expect ( getSendCount ( ) ) . toEqual ( 1 ) ;
262
- expect ( getCalls ( ) ) . toEqual ( [ 'push' , 'pop ' , 'pop ' ] ) ;
262
+ expect ( getCalls ( ) ) . toEqual ( [ 'push' , 'shift ' , 'shift ' ] ) ;
263
263
} ,
264
264
START_DELAY + 2_000 ,
265
265
) ;
@@ -279,7 +279,7 @@ describe('makeOfflineTransport', () => {
279
279
await waitUntil ( ( ) => getCalls ( ) . length === 3 && getSendCount ( ) === 2 , START_DELAY * 2 ) ;
280
280
281
281
expect ( getSendCount ( ) ) . toEqual ( 2 ) ;
282
- expect ( getCalls ( ) ) . toEqual ( [ 'pop ' , 'pop ' , 'pop ' ] ) ;
282
+ expect ( getCalls ( ) ) . toEqual ( [ 'shift ' , 'shift ' , 'shift ' ] ) ;
283
283
} ,
284
284
START_DELAY + 2_000 ,
285
285
) ;
@@ -299,7 +299,7 @@ describe('makeOfflineTransport', () => {
299
299
await waitUntil ( ( ) => getCalls ( ) . length === 2 , START_DELAY * 2 ) ;
300
300
301
301
expect ( getSendCount ( ) ) . toEqual ( 0 ) ;
302
- expect ( getCalls ( ) ) . toEqual ( [ 'pop ' , 'unshift' ] ) ;
302
+ expect ( getCalls ( ) ) . toEqual ( [ 'shift ' , 'unshift' ] ) ;
303
303
} ,
304
304
START_DELAY + 2_000 ,
305
305
) ;
@@ -361,12 +361,12 @@ describe('makeOfflineTransport', () => {
361
361
// We're sending a replay envelope and they always get queued
362
362
'push' ,
363
363
// The first envelope popped out fails to send so it gets added to the front of the queue
364
- 'pop ' ,
364
+ 'shift ' ,
365
365
'unshift' ,
366
366
// The rest of the attempts succeed
367
- 'pop ' ,
368
- 'pop ' ,
369
- 'pop ' ,
367
+ 'shift ' ,
368
+ 'shift ' ,
369
+ 'shift ' ,
370
370
] ) ;
371
371
372
372
const envelopes = getSentEnvelopes ( ) . map ( parseEnvelope ) ;
@@ -416,7 +416,7 @@ describe('makeOfflineTransport', () => {
416
416
417
417
expect ( getSendCount ( ) ) . toEqual ( 2 ) ;
418
418
expect ( queuedCount ) . toEqual ( 0 ) ;
419
- expect ( getCalls ( ) ) . toEqual ( [ 'pop ' , 'pop ' ] ) ;
419
+ expect ( getCalls ( ) ) . toEqual ( [ 'shift ' , 'shift ' ] ) ;
420
420
} ,
421
421
START_DELAY * 3 ,
422
422
) ;
0 commit comments