Skip to content

Commit a58c4eb

Browse files
committed
Added additional test cases for got package.
1 parent 7bd1c4d commit a58c4eb

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ test_ClientRequest
9797
| tst.js:319:5:319:26 | superag ... ', url) |
9898
| tst.js:320:5:320:23 | superagent.del(url) |
9999
| tst.js:321:5:321:32 | superag ... st(url) |
100+
| tst.js:328:5:328:38 | got(und ... ptions) |
101+
| tst.js:329:5:329:45 | got(und ... {url})) |
102+
| tst.js:337:5:337:20 | jsonClient.get() |
100103
test_getADataNode
101104
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
102105
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
@@ -254,6 +257,8 @@ test_getUrl
254257
| tst.js:319:5:319:26 | superag ... ', url) | tst.js:319:23:319:25 | url |
255258
| tst.js:320:5:320:23 | superagent.del(url) | tst.js:320:20:320:22 | url |
256259
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:29:321:31 | url |
260+
| tst.js:328:5:328:38 | got(und ... ptions) | tst.js:328:9:328:17 | undefined |
261+
| tst.js:329:5:329:45 | got(und ... {url})) | tst.js:329:9:329:17 | undefined |
257262
test_getAResponseDataNode
258263
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
259264
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
@@ -334,3 +339,6 @@ test_getAResponseDataNode
334339
| tst.js:319:5:319:26 | superag ... ', url) | tst.js:319:5:319:26 | superag ... ', url) | stream | true |
335340
| tst.js:320:5:320:23 | superagent.del(url) | tst.js:320:5:320:23 | superagent.del(url) | stream | true |
336341
| tst.js:321:5:321:32 | superag ... st(url) | tst.js:321:5:321:32 | superag ... st(url) | stream | true |
342+
| tst.js:328:5:328:38 | got(und ... ptions) | tst.js:328:5:328:38 | got(und ... ptions) | text | true |
343+
| tst.js:329:5:329:45 | got(und ... {url})) | tst.js:329:5:329:45 | got(und ... {url})) | text | true |
344+
| tst.js:337:5:337:20 | jsonClient.get() | tst.js:337:5:337:20 | jsonClient.get() | text | true |

javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,22 @@ function useSuperagent(url){
320320
superagent.del(url);
321321
superagent.agent().post(url).send(data);
322322
}
323+
324+
import { Options } from 'got';
325+
326+
function gotTests(url){
327+
const options = new Options({url});
328+
got(undefined, undefined, options); // undefined is flagged, but should be url from options
329+
got(undefined, undefined, Options({url})); // undefined is flagged, but should be url from options
330+
331+
const options2 = new Options({url});
332+
got.extend(options2).extend(options).get(); // not flagged
333+
334+
got.paginate(url, {}); // not flagged
335+
336+
const jsonClient = got.extend({url: url});
337+
jsonClient.get(); // call flagged not the actual url flow
338+
339+
const jsonClient2 = got.extend({url: url}).extend({url: url});
340+
jsonClient2.get(); // not flagged
341+
}

0 commit comments

Comments
 (0)