Skip to content

Commit 41ef0fa

Browse files
test: coverage of no takeUntil, namespace
1 parent c4e297e commit 41ef0fa

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/rules/no-sharereplay-before-takeuntil.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ruleTester({ types: false }).run('no-sharereplay-before-takeuntil', noSharerepla
2525
a.pipe(shareReplay({ refCount: t }), takeUntil(b));
2626
`,
2727
stripIndent`
28-
// refCount variable not supported
28+
// refCount as variable not supported
2929
import { of, takeUntil, shareReplay } from "rxjs";
3030
3131
const a = of("a");
@@ -53,6 +53,32 @@ ruleTester({ types: false }).run('no-sharereplay-before-takeuntil', noSharerepla
5353
5454
a.pipe(takeUntil(b), shareReplay({ refCount: false }));
5555
`,
56+
stripIndent`
57+
// shareReplay after takeUntil with operators in between
58+
import { of, takeUntil, shareReplay, map, filter } from "rxjs";
59+
60+
const a = of("a");
61+
const b = of("b");
62+
63+
a.pipe(takeUntil(b), map(x => x), filter(x => !!x), shareReplay());
64+
`,
65+
stripIndent`
66+
// namespace import with refCount true
67+
import * as Rx from "rxjs";
68+
69+
const a = Rx.of("a");
70+
const b = Rx.of("b");
71+
72+
a.pipe(Rx.shareReplay({ refCount: true }), Rx.takeUntil(b));
73+
`,
74+
stripIndent`
75+
// shareReplay by itself
76+
import { of, shareReplay } from "rxjs";
77+
78+
const a = of("a");
79+
80+
a.pipe(shareReplay());
81+
`,
5682
stripIndent`
5783
// unrelated
5884
import { of, takeUntil, toArray } from "rxjs";

0 commit comments

Comments
 (0)