File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -326,4 +326,17 @@ describe('retry operator', () => {
326
326
327
327
expect ( sideEffects ) . to . deep . equal ( [ 0 , 1 , 2 ] ) ;
328
328
} ) ;
329
+
330
+ it ( 'should not alter the source when the number of retries is smaller than 1' , ( ) => {
331
+ const source = cold ( '--1-2-3-#' ) ;
332
+ const subs = [ '^ !' ] ;
333
+
334
+ const expected = '--1-2-3-#' ;
335
+ const unsub = ' !' ;
336
+
337
+ const result = source . pipe ( retry ( 0 ) ) ;
338
+
339
+ expectObservable ( result , unsub ) . toBe ( expected ) ;
340
+ expectSubscriptions ( source . subscriptions ) . toBe ( subs ) ;
341
+ } )
329
342
} ) ;
Original file line number Diff line number Diff line change 1
1
import { MonoTypeOperatorFunction } from '../types' ;
2
2
import { operate } from '../util/lift' ;
3
3
import { Subscription } from '../Subscription' ;
4
- import { EMPTY } from '../observable/empty' ;
5
4
import { OperatorSubscriber } from './OperatorSubscriber' ;
5
+ import { identity } from '../util/identity' ;
6
6
7
7
export interface RetryConfig {
8
8
count : number ;
@@ -69,7 +69,7 @@ export function retry<T>(configOrCount: number | RetryConfig = Infinity): MonoTy
69
69
const { count, resetOnSuccess = false } = config ;
70
70
71
71
return count <= 0
72
- ? ( ) => EMPTY
72
+ ? identity
73
73
: operate ( ( source , subscriber ) => {
74
74
let soFar = 0 ;
75
75
let innerSub : Subscription | null ;
You can’t perform that action at this time.
0 commit comments