Skip to content

Commit 4a237ba

Browse files
Add test data for variant analysis
We will need to set up some VariantAnalysisHistoryItem types in order to use them in our tests. We're repeating what we've done for RemoteQueryHistoryItem for now. Separately we'll think about setting up tests that check for both remote queries and variant analysis in the query history. At the moment we'd like to focus on just adding some test coverage for variant analysis history items. Co-authored-by: Nora Scheuch <norascheuch@github.com>
1 parent 319d8ce commit 4a237ba

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @name Variant Analysis Integration Test 1
3+
* @kind problem
4+
* @problem.severity warning
5+
* @id javascript/variant-analysis-integration-test-1
6+
*/
7+
import javascript
8+
9+
from MemberDeclaration md
10+
where md.getName() = "dispose"
11+
select md, "Dispose method"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @name Variant Analysis Integration Test 2
3+
* @kind problem
4+
* @problem.severity warning
5+
* @id ruby/example/empty-block
6+
*/
7+
8+
import ruby
9+
10+
from Block b
11+
where b.getNumberOfStatements() = 0
12+
select b, "This is an empty block."
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"version": 1,
3+
"queries": [
4+
{
5+
"t": "variant-analysis",
6+
"status": "Completed",
7+
"completed": true,
8+
"historyItemId": "12349821",
9+
"variantAnalysis": {
10+
"id": 98574321397,
11+
"controllerRepoId": 128321,
12+
"query": {
13+
"name": "Variant Analysis Integration Test 1",
14+
"filePath": "PLACEHOLDER/q2.ql",
15+
"language": "javascript",
16+
"text": "/**\n * @name Variant Analysis Integration Test 1\n * @kind problem\n * @problem.severity warning\n * @id javascript/variant-analysis-integration-test-1\n */\nimport javascript\n\nfrom MemberDeclaration md\nwhere md.getName() = \"dispose\"\nselect md, \"Dispose method\"\n"
17+
},
18+
"databases": {
19+
"repositories": ["234321", "123301"]
20+
},
21+
"createdAt": "1666688269308",
22+
"updatedAt": "1666688869308",
23+
"executionStartTime": 1645644973911,
24+
"status": "succeeded",
25+
"actionsWorkflowRunId": 1889316048
26+
}
27+
},
28+
{
29+
"t": "variant-analysis",
30+
"status": "Completed",
31+
"completed": true,
32+
"historyItemId": "12349821",
33+
"variantAnalysis": {
34+
"id": 98574321397,
35+
"controllerRepoId": 128321,
36+
"query": {
37+
"name": "Variant Analysis Integration Test 2",
38+
"filePath": "PLACEHOLDER/q2.ql",
39+
"language": "ruby",
40+
"text": "/**\n * @name Variant Analysis Integration Test 2\n * @kind problem\n * @problem.severity warning\n * @id ruby/example/empty-block\n */\nimport ruby\n\nfrom Block b\nwhere b.getNumberOfStatements() = 0\nselect b, \"This is an empty block.\"\n"
41+
},
42+
"databases": {
43+
"repositories": ["92384123", "1230871"]
44+
},
45+
"createdAt": "1666689080847",
46+
"updatedAt": "1666689080847",
47+
"executionStartTime": 1645644973911,
48+
"status": "succeeded",
49+
"actionsWorkflowRunId": 1889316048
50+
}
51+
}
52+
]
53+
}

0 commit comments

Comments
 (0)