Skip to content

Commit

Permalink
chore(dtslint): add find tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jul 28, 2018
1 parent a9c06f4 commit 13e24f1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec-dtslint/operators/find-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { of } from 'rxjs';
import { find } from 'rxjs/operators';

it('should support a user-defined type guard', () => {
const o = of('foo').pipe(find((s: string): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined>
});

it('should support a user-defined type guard that takes an index', () => {
const o = of('foo').pipe(find((s, index): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined>
});

it('should support a user-defined type guard that takes an index and the source', () => {
const o = of('foo').pipe(find((s, index): s is 'foo' => true)); // $ExpectType Observable<"foo" | undefined>
});

it('should support a predicate', () => {
const o = of('foo').pipe(find(s => true)); // $ExpectType Observable<string | undefined>
});

it('should support a predicate that takes an index', () => {
const o = of('foo').pipe(find((s, index) => true)); // $ExpectType Observable<string | undefined>
});

it('should support a predicate that takes an index and the source', () => {
const o = of('foo').pipe(find((s, index, source) => true)); // $ExpectType Observable<string | undefined>
});

0 comments on commit 13e24f1

Please sign in to comment.