@@ -20,7 +20,7 @@ import {
2020import { testDisposeHandler } from "../../test-dispose-handler" ;
2121import { QueryRunner } from "../../../../src/query-server/query-runner" ;
2222import * as dialog from "../../../../src/common/vscode/dialog" ;
23- import { Setting } from "../../../../src/config" ;
23+ import * as config from "../../../../src/config" ;
2424import { QlPackGenerator } from "../../../../src/local-queries/qlpack-generator" ;
2525import { mockedObject } from "../../utils/mocking.helpers" ;
2626import { createMockApp } from "../../../__mocks__/appMock" ;
@@ -626,12 +626,15 @@ describe("local databases", () => {
626626 showNeverAskAgainDialogSpy = jest
627627 . spyOn ( dialog , "showNeverAskAgainDialog" )
628628 . mockResolvedValue ( "No, and never ask me again" ) ;
629- const updateValueSpy = jest . spyOn ( Setting . prototype , "updateValue" ) ;
629+ const setAutogenerateQlPacksSpy = jest . spyOn (
630+ config ,
631+ "setAutogenerateQlPacks" ,
632+ ) ;
630633
631634 await ( databaseManager as any ) . createSkeletonPacks ( mockDbItem ) ;
632635
633636 expect ( generateSpy ) . not . toBeCalled ( ) ;
634- expect ( updateValueSpy ) . toHaveBeenCalledWith ( "never" , 2 ) ;
637+ expect ( setAutogenerateQlPacksSpy ) . toHaveBeenCalledWith ( "never" ) ;
635638 } ) ;
636639
637640 it ( "should create the skeleton QL pack for the user" , async ( ) => {
@@ -735,7 +738,7 @@ describe("local databases", () => {
735738 describe ( "when codeQL.codespacesTemplate is set to true" , ( ) => {
736739 describe ( "when we add the tutorial database to the codespace" , ( ) => {
737740 it ( "should not offer to create a skeleton QL pack" , async ( ) => {
738- jest . spyOn ( Setting . prototype , "getValue " ) . mockReturnValue ( true ) ;
741+ jest . spyOn ( config , "isCodespacesTemplate " ) . mockReturnValue ( true ) ;
739742
740743 const isTutorialDatabase = true ;
741744 const makeSelected = true ;
@@ -754,7 +757,7 @@ describe("local databases", () => {
754757
755758 describe ( "when we add a new database that isn't the tutorial one" , ( ) => {
756759 it ( "should create a skeleton QL pack" , async ( ) => {
757- jest . spyOn ( Setting . prototype , "getValue " ) . mockReturnValue ( true ) ;
760+ jest . spyOn ( config , "isCodespacesTemplate " ) . mockReturnValue ( true ) ;
758761
759762 await databaseManager . openDatabase ( mockDbItem . databaseUri ) ;
760763
@@ -763,18 +766,9 @@ describe("local databases", () => {
763766 } ) ;
764767 } ) ;
765768
766- describe ( "when codeQL.codespacesTemplate is set to false" , ( ) => {
767- it ( "should not create a skeleton QL pack" , async ( ) => {
768- jest . spyOn ( Setting . prototype , "getValue" ) . mockReturnValue ( false ) ;
769-
770- await databaseManager . openDatabase ( mockDbItem . databaseUri ) ;
771- expect ( createSkeletonPacksSpy ) . toBeCalledTimes ( 0 ) ;
772- } ) ;
773- } ) ;
774-
775- describe ( "when codeQL.codespacesTemplate is not set" , ( ) => {
769+ describe ( "when codeQL.codespacesTemplate is set to false or not defined" , ( ) => {
776770 it ( "should not create a skeleton QL pack" , async ( ) => {
777- jest . spyOn ( Setting . prototype , "getValue " ) . mockReturnValue ( undefined ) ;
771+ jest . spyOn ( config , "isCodespacesTemplate " ) . mockReturnValue ( false ) ;
778772
779773 await databaseManager . openDatabase ( mockDbItem . databaseUri ) ;
780774 expect ( createSkeletonPacksSpy ) . toBeCalledTimes ( 0 ) ;
0 commit comments