Skip to content

Commit e6ae8bb

Browse files
committed
Added test cases where second parameter passed to pipe is a function and some popular library ones
1 parent ac24fdd commit e6ae8bb

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import * as rx from 'rxjs';
22
import * as ops from 'rxjs/operators';
3+
import { TestScheduler } from 'rxjs/testing';
4+
35

46
const { of, from } = rx;
57
const { map, filter } = ops;
68

79
function f(){
810
of(1, 2, 3).pipe(map(x => x * 2));
911
someNonStream().pipe(map(x => x * 2));
12+
13+
let testScheduler = new TestScheduler();
14+
testScheduler.run(({x, y, z}) => {
15+
const source = x('', {o: [a, b, c]});
16+
z(source.pipe(null)).toBe(expected,y,); // $SPURIOUS:Alert
17+
});
1018
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { async } from '@strapi/utils';
2+
3+
const f = async () => {
4+
const permissionsInDB = await async.pipe(strapi.db.query('x').findMany,map('y'))(); // $SPURIOUS:Alert
5+
}

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
| rxjsStreams.js:16:7:16:23 | source.pipe(null) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
2+
| strapi.js:4:35:4:84 | async.p ... p('y')) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
13
| test.js:4:5:4:28 | stream. ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
24
| test.js:19:5:19:17 | s2.pipe(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
35
| test.js:45:5:45:30 | stream2 ... ation2) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
@@ -11,3 +13,4 @@
1113
| test.js:143:5:143:62 | stream. ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1214
| test.js:175:17:175:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1315
| test.js:185:5:185:32 | copyStr ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
16+
| test.js:216:5:216:38 | notStre ... ()=>{}) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,8 @@ function test() {
211211
const p = plumber();
212212
getStream().pipe(p).pipe(dest).pipe(dest).pipe(dest);
213213
}
214+
{
215+
const notStream = getNotAStream();
216+
notStream.pipe(getStream(),()=>{}); // $SPURIOUS:Alert
217+
}
214218
}

0 commit comments

Comments
 (0)