@@ -14,7 +14,6 @@ import { mockedObject, mockedUri } from "../../utils/mocking.helpers";
1414import { CodeQLCliServer } from "../../../../src/codeql-cli/cli" ;
1515import { QueryRunner } from "../../../../src/query-server" ;
1616import * as queryResolver from "../../../../src/local-queries/query-resolver" ;
17- import * as standardQueries from "../../../../src/local-queries/standard-queries" ;
1817import { MethodSignature } from "../../../../src/data-extensions-editor/external-api-usage" ;
1918import { join } from "path" ;
2019import { exists , readFile } from "fs-extra" ;
@@ -23,40 +22,27 @@ import { CancellationTokenSource } from "vscode-jsonrpc";
2322import { QueryOutputDir } from "../../../../src/run-queries-shared" ;
2423
2524describe ( "runAutoModelQueries" , ( ) => {
26- const qlpack = {
27- dbschemePack : "dbschemePack" ,
28- dbschemePackIsLibraryPack : false ,
29- } ;
30-
3125 let resolveQueriesSpy : jest . SpiedFunction <
3226 typeof queryResolver . resolveQueries
3327 > ;
34- let createLockFileForStandardQuerySpy : jest . SpiedFunction <
35- typeof standardQueries . createLockFileForStandardQuery
36- > ;
37-
3828 beforeEach ( ( ) => {
39- jest . spyOn ( queryResolver , "qlpackOfDatabase" ) . mockResolvedValue ( qlpack ) ;
40-
4129 resolveQueriesSpy = jest
4230 . spyOn ( queryResolver , "resolveQueries" )
43- . mockImplementation ( async ( _cliServer , _qlPack , _name , constraints ) => {
44- if ( constraints [ "tags contain all" ] ?. includes ( "candidates" ) ) {
45- return [ "/a/b/c/ql/candidates.ql" ] ;
46- }
47- if ( constraints [ "tags contain all" ] ?. includes ( "positive" ) ) {
48- return [ "/a/b/c/ql/positive-examples.ql" ] ;
49- }
50- if ( constraints [ "tags contain all" ] ?. includes ( "negative" ) ) {
51- return [ "/a/b/c/ql/negative-examples.ql" ] ;
52- }
31+ . mockImplementation (
32+ async ( _cliServer , _packsToSearch , _name , constraints ) => {
33+ if ( constraints [ "tags contain all" ] ?. includes ( "candidates" ) ) {
34+ return [ "/a/b/c/ql/candidates.ql" ] ;
35+ }
36+ if ( constraints [ "tags contain all" ] ?. includes ( "positive" ) ) {
37+ return [ "/a/b/c/ql/positive-examples.ql" ] ;
38+ }
39+ if ( constraints [ "tags contain all" ] ?. includes ( "negative" ) ) {
40+ return [ "/a/b/c/ql/negative-examples.ql" ] ;
41+ }
5342
54- return [ ] ;
55- } ) ;
56-
57- createLockFileForStandardQuerySpy = jest
58- . spyOn ( standardQueries , "createLockFileForStandardQuery" )
59- . mockResolvedValue ( { } ) ;
43+ return [ ] ;
44+ } ,
45+ ) ;
6046 } ) ;
6147
6248 it ( "should run the query and return the results" , async ( ) => {
@@ -154,18 +140,13 @@ describe("runAutoModelQueries", () => {
154140 expect ( resolveQueriesSpy ) . toHaveBeenCalledTimes ( 1 ) ;
155141 expect ( resolveQueriesSpy ) . toHaveBeenCalledWith (
156142 options . cliServer ,
157- qlpack ,
143+ [ "codeql/java-queries" ] ,
158144 "Extract automodel candidates" ,
159145 {
160146 kind : "problem" ,
161147 "tags contain all" : [ "automodel" , "application-mode" , "candidates" ] ,
162148 } ,
163149 ) ;
164- expect ( createLockFileForStandardQuerySpy ) . toHaveBeenCalledTimes ( 1 ) ;
165- expect ( createLockFileForStandardQuerySpy ) . toHaveBeenCalledWith (
166- options . cliServer ,
167- "/a/b/c/ql/candidates.ql" ,
168- ) ;
169150 expect ( options . queryRunner . createQueryRun ) . toHaveBeenCalledTimes ( 1 ) ;
170151 expect ( options . queryRunner . createQueryRun ) . toHaveBeenCalledWith (
171152 "/a/b/c/src.zip" ,
0 commit comments