forked from ReactiveX/rxjs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dtslint): add onErrorResumeNext (ReactiveX#4356)
* test(dtslint): add onErrorResumeNext * chore(typings): refine onErrorResumeNext types * chore(dtslint): remove selector type * chore(dtslint): enhance rest typings * chore(dtslint): update compat typings * test(dtslint): update tests to typings
- Loading branch information
1 parent
7815588
commit ba6a5e4
Showing
3 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { of } from 'rxjs'; | ||
import { onErrorResumeNext } from 'rxjs/operators'; | ||
|
||
it('should infer correctly', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext()); // $ExpectType Observable<string> | ||
}); | ||
|
||
it('should accept one input', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1))); // $ExpectType Observable<string | number> | ||
const p = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of('5'))); // $ExpectType Observable<string> | ||
}); | ||
|
||
it('should accept promises', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(Promise.resolve(5))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept iterables', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext('foo')); // $ExpectType Observable<string> | ||
}); | ||
|
||
it('should accept arrays', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext([5])); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept two inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept three inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept four inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept five inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept six inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5), of('6'))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should accept seven and more inputs', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(of(1), of(2), of('3'), of('4'), of(5), of('6'), of(7))); // $ExpectType Observable<string | {}> | ||
const p = of('apple', 'banana', 'peach').pipe(onErrorResumeNext<string, string | number>(of(1), of(2), of('3'), of('4'), of(5), of('6'), of(7))); // $ExpectType Observable<string | number> | ||
}); | ||
|
||
it('should enforce types', () => { | ||
const o = of('apple', 'banana', 'peach').pipe(onErrorResumeNext(5)); // $ExpectError | ||
}); | ||
|
||
it('should enforce source types', () => { | ||
const p = of('apple', 'banana', 'peach').pipe(onErrorResumeNext<number, number>(of(5))); // $ExpectError | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters