Skip to content

Commit bd1d9ed

Browse files
committed
JS: Add test
1 parent 0fcdf91 commit bd1d9ed

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
test_CheerioRef
2+
| tst.js:1:1:1:30 | import ... eerio"; |
3+
| tst.js:1:8:1:14 | cheerio |
4+
| tst.js:4:11:4:23 | getTemplate() |
5+
| tst.js:9:10:9:36 | cheerio ... t</b>') |
6+
test_CheerioObjectCreation
7+
| tst.js:5:3:5:18 | $.attr('foo', 5) |
8+
| tst.js:9:10:9:36 | cheerio ... t</b>') |
9+
test_AttributeDefinition
10+
| tst.js:5:3:5:18 | $.attr('foo', 5) |
11+
test_CheerioObjectRef
12+
| tst.js:4:11:4:23 | getTemplate() |
13+
| tst.js:5:3:5:18 | $.attr('foo', 5) |
14+
| tst.js:5:3:5:33 | $.attr( ... ar', 6) |
15+
| tst.js:5:3:5:41 | $.attr( ... html(x) |
16+
| tst.js:9:10:9:36 | cheerio ... t</b>') |
17+
test_XssSink
18+
| tst.js:5:40:5:40 | x |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import javascript
2+
3+
query DataFlow::Node test_CheerioRef() { result = Cheerio::cheerioRef() }
4+
5+
query Cheerio::CheerioObjectCreation test_CheerioObjectCreation() { any() }
6+
7+
query DOM::AttributeDefinition test_AttributeDefinition() { any() }
8+
9+
query DataFlow::Node test_CheerioObjectRef() { result = Cheerio::cheerioObjectRef() }
10+
11+
query Cheerio::XssSink test_XssSink() { any() }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import cheerio from "cheerio";
2+
3+
function test(x) {
4+
let $ = getTemplate();
5+
$.attr('foo', 5).data('bar', 6).html(x);
6+
}
7+
8+
function getTemplate() {
9+
return cheerio.load('<b>text</b>');
10+
}

0 commit comments

Comments
 (0)