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>
This commit is contained in:
Elena Tanasoiu
2022-10-25 11:05:06 +01:00
parent 319d8ce0f5
commit 4a237ba019
3 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
/**
* @name Variant Analysis Integration Test 1
* @kind problem
* @problem.severity warning
* @id javascript/variant-analysis-integration-test-1
*/
import javascript
from MemberDeclaration md
where md.getName() = "dispose"
select md, "Dispose method"

View File

@@ -0,0 +1,12 @@
/**
* @name Variant Analysis Integration Test 2
* @kind problem
* @problem.severity warning
* @id ruby/example/empty-block
*/
import ruby
from Block b
where b.getNumberOfStatements() = 0
select b, "This is an empty block."

View File

@@ -0,0 +1,53 @@
{
"version": 1,
"queries": [
{
"t": "variant-analysis",
"status": "Completed",
"completed": true,
"historyItemId": "12349821",
"variantAnalysis": {
"id": 98574321397,
"controllerRepoId": 128321,
"query": {
"name": "Variant Analysis Integration Test 1",
"filePath": "PLACEHOLDER/q2.ql",
"language": "javascript",
"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"
},
"databases": {
"repositories": ["234321", "123301"]
},
"createdAt": "1666688269308",
"updatedAt": "1666688869308",
"executionStartTime": 1645644973911,
"status": "succeeded",
"actionsWorkflowRunId": 1889316048
}
},
{
"t": "variant-analysis",
"status": "Completed",
"completed": true,
"historyItemId": "12349821",
"variantAnalysis": {
"id": 98574321397,
"controllerRepoId": 128321,
"query": {
"name": "Variant Analysis Integration Test 2",
"filePath": "PLACEHOLDER/q2.ql",
"language": "ruby",
"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"
},
"databases": {
"repositories": ["92384123", "1230871"]
},
"createdAt": "1666689080847",
"updatedAt": "1666689080847",
"executionStartTime": 1645644973911,
"status": "succeeded",
"actionsWorkflowRunId": 1889316048
}
}
]
}