@@ -56,11 +56,8 @@ describe("SkeletonQueryWizard", () => {
5656 let createExampleQlFileSpy : jest . SpiedFunction <
5757 typeof QlPackGenerator . prototype . createExampleQlFile
5858 > ;
59- let downloadGitHubDatabaseSpy : jest . SpiedFunction <
60- DatabaseFetcher [ "downloadGitHubDatabase" ]
61- > ;
62- let askForGitHubRepoSpy : jest . SpiedFunction <
63- DatabaseFetcher [ "askForGitHubRepo" ]
59+ let promptImportGithubDatabaseSpy : jest . SpiedFunction <
60+ DatabaseFetcher [ "promptImportGithubDatabase" ]
6461 > ;
6562 let openTextDocumentSpy : jest . SpiedFunction <
6663 typeof workspace . openTextDocument
@@ -141,8 +138,8 @@ describe("SkeletonQueryWizard", () => {
141138 createExampleQlFileSpy = jest
142139 . spyOn ( QlPackGenerator . prototype , "createExampleQlFile" )
143140 . mockResolvedValue ( undefined ) ;
144- downloadGitHubDatabaseSpy = jest
145- . spyOn ( databaseFetcher , "downloadGitHubDatabase " )
141+ promptImportGithubDatabaseSpy = jest
142+ . spyOn ( databaseFetcher , "promptImportGithubDatabase " )
146143 . mockResolvedValue ( undefined ) ;
147144 openTextDocumentSpy = jest
148145 . spyOn ( workspace , "openTextDocument" )
@@ -156,10 +153,6 @@ describe("SkeletonQueryWizard", () => {
156153 databaseFetcher ,
157154 selectedItems ,
158155 ) ;
159-
160- askForGitHubRepoSpy = jest
161- . spyOn ( databaseFetcher , "askForGitHubRepo" )
162- . mockResolvedValue ( QUERY_LANGUAGE_TO_DATABASE_REPO [ chosenLanguage ] ) ;
163156 } ) ;
164157
165158 afterEach ( async ( ) => {
@@ -210,7 +203,7 @@ describe("SkeletonQueryWizard", () => {
210203 title : "Download database" ,
211204 } ) ,
212205 ) ;
213- expect ( downloadGitHubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
206+ expect ( promptImportGithubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
214207 } ) ;
215208
216209 it ( "should download database for selected language when selecting download in prompt" , async ( ) => {
@@ -227,7 +220,7 @@ describe("SkeletonQueryWizard", () => {
227220 await wizard . execute ( ) ;
228221 await wizard . waitForDownload ( ) ;
229222
230- expect ( downloadGitHubDatabaseSpy ) . toHaveBeenCalled ( ) ;
223+ expect ( promptImportGithubDatabaseSpy ) . toHaveBeenCalled ( ) ;
231224 } ) ;
232225
233226 it ( "should open the query file" , async ( ) => {
@@ -336,7 +329,7 @@ describe("SkeletonQueryWizard", () => {
336329 it ( "should not download a new database for language" , async ( ) => {
337330 await wizard . execute ( ) ;
338331
339- expect ( downloadGitHubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
332+ expect ( promptImportGithubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
340333 } ) ;
341334
342335 it ( "should not select the database" , async ( ) => {
@@ -385,7 +378,7 @@ describe("SkeletonQueryWizard", () => {
385378 it ( "should not download a new database for language" , async ( ) => {
386379 await wizard . execute ( ) ;
387380
388- expect ( downloadGitHubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
381+ expect ( promptImportGithubDatabaseSpy ) . not . toHaveBeenCalled ( ) ;
389382 } ) ;
390383
391384 it ( "should select an existing database" , async ( ) => {
@@ -417,54 +410,23 @@ describe("SkeletonQueryWizard", () => {
417410 } ) ;
418411
419412 describe ( "if database is missing" , ( ) => {
420- describe ( "if the user chooses to downloaded the suggested database from GitHub" , ( ) => {
421- beforeEach ( ( ) => {
422- showInformationMessageSpy . mockImplementation (
423- async ( _message , options , item ) => {
424- if ( item === undefined ) {
425- return options as MessageItem ;
426- }
427-
428- return item ;
429- } ,
430- ) ;
431- } ) ;
432-
433- it ( "should download a new database for language" , async ( ) => {
434- await wizard . execute ( ) ;
435- await wizard . waitForDownload ( ) ;
436-
437- expect ( askForGitHubRepoSpy ) . toHaveBeenCalled ( ) ;
438- expect ( downloadGitHubDatabaseSpy ) . toHaveBeenCalled ( ) ;
439- } ) ;
413+ beforeEach ( ( ) => {
414+ showInformationMessageSpy . mockImplementation (
415+ async ( _message , options , item ) => {
416+ if ( item === undefined ) {
417+ return options as MessageItem ;
418+ }
419+
420+ return item ;
421+ } ,
422+ ) ;
440423 } ) ;
441424
442- describe ( "if the user choses to download a different database from GitHub than the one suggested" , ( ) => {
443- beforeEach ( ( ) => {
444- showInformationMessageSpy . mockImplementation (
445- async ( _message , options , item ) => {
446- if ( item === undefined ) {
447- return options as MessageItem ;
448- }
449-
450- return item ;
451- } ,
452- ) ;
453-
454- const chosenGitHubRepo = "pickles-owner/pickles-repo" ;
455-
456- askForGitHubRepoSpy = jest
457- . spyOn ( databaseFetcher , "askForGitHubRepo" )
458- . mockResolvedValue ( chosenGitHubRepo ) ;
459- } ) ;
460-
461- it ( "should download the newly chosen database" , async ( ) => {
462- await wizard . execute ( ) ;
463- await wizard . waitForDownload ( ) ;
425+ it ( "should download a new database for language" , async ( ) => {
426+ await wizard . execute ( ) ;
427+ await wizard . waitForDownload ( ) ;
464428
465- expect ( askForGitHubRepoSpy ) . toHaveBeenCalled ( ) ;
466- expect ( downloadGitHubDatabaseSpy ) . toHaveBeenCalled ( ) ;
467- } ) ;
429+ expect ( promptImportGithubDatabaseSpy ) . toHaveBeenCalled ( ) ;
468430 } ) ;
469431 } ) ;
470432 } ) ;
0 commit comments