11import { expect } from 'chai' ;
22
33import { QueryStatus } from '../../src/query-status' ;
4- import { buildRepoLabel , getQueryHistoryItemId , getQueryText , getRawQueryName } from '../../src/query-history-info' ;
4+ import { buildRepoLabel , getQueryId , getQueryText , getRawQueryName } from '../../src/query-history-info' ;
55import { VariantAnalysisHistoryItem } from '../../src/remote-queries/variant-analysis-history-item' ;
66import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis' ;
77import { createMockScannedRepos } from '../../src/vscode-tests/factories/remote-queries/shared/scanned-repositories' ;
@@ -19,7 +19,6 @@ describe('Query history info', () => {
1919 t : 'variant-analysis' ,
2020 status : QueryStatus . InProgress ,
2121 completed : false ,
22- historyItemId : 'abc123' ,
2322 variantAnalysis : createMockVariantAnalysis (
2423 VariantAnalysisStatus . InProgress ,
2524 createMockScannedRepos ( [
@@ -51,23 +50,23 @@ describe('Query history info', () => {
5150 } ) ;
5251 } ) ;
5352
54- describe ( 'getQueryHistoryItemId ' , ( ) => {
53+ describe ( 'getQueryId ' , ( ) => {
5554 it ( 'should get the ID for local history items' , ( ) => {
56- const historyItemId = getQueryHistoryItemId ( localQueryHistoryItem ) ;
55+ const historyItemId = getQueryId ( localQueryHistoryItem ) ;
5756
5857 expect ( historyItemId ) . to . equal ( localQueryHistoryItem . initialInfo . id ) ;
5958 } ) ;
6059
6160 it ( 'should get the ID for remote query history items' , ( ) => {
62- const historyItemId = getQueryHistoryItemId ( remoteQueryHistoryItem ) ;
61+ const historyItemId = getQueryId ( remoteQueryHistoryItem ) ;
6362
6463 expect ( historyItemId ) . to . equal ( remoteQueryHistoryItem . queryId ) ;
6564 } ) ;
6665
6766 it ( 'should get the ID for variant analysis history items' , ( ) => {
68- const historyItemId = getQueryHistoryItemId ( variantAnalysisHistoryItem ) ;
67+ const historyItemId = getQueryId ( variantAnalysisHistoryItem ) ;
6968
70- expect ( historyItemId ) . to . equal ( variantAnalysisHistoryItem . historyItemId ) ;
69+ expect ( historyItemId ) . to . equal ( variantAnalysisHistoryItem . variantAnalysis . id . toString ( ) ) ;
7170 } ) ;
7271 } ) ;
7372
@@ -100,10 +99,10 @@ describe('Query history info', () => {
10099 expect ( repoLabel ) . to . equal ( expectedRepoLabel ) ;
101100 } ) ;
102101 it ( 'should return number of repositories when `repositoryCount` is non-zero' , ( ) => {
103- const remoteQueryHistoryItem2 = createMockRemoteQueryHistoryItem ( { repositoryCount : 3 } ) ;
102+ const remoteQueryHistoryItem2 = createMockRemoteQueryHistoryItem ( { repositoryCount : 3 } ) ;
104103 const repoLabel2 = buildRepoLabel ( remoteQueryHistoryItem2 ) ;
105104 const expectedRepoLabel2 = '3 repositories' ;
106-
105+
107106 expect ( repoLabel2 ) . to . equal ( expectedRepoLabel2 ) ;
108107 } ) ;
109108 } ) ;
@@ -113,7 +112,6 @@ describe('Query history info', () => {
113112 t : 'variant-analysis' ,
114113 status : QueryStatus . InProgress ,
115114 completed : false ,
116- historyItemId : 'abc123' ,
117115 variantAnalysis : createMockVariantAnalysis (
118116 VariantAnalysisStatus . InProgress ,
119117 createMockScannedRepos ( [ ] )
@@ -128,7 +126,6 @@ describe('Query history info', () => {
128126 t : 'variant-analysis' ,
129127 status : QueryStatus . InProgress ,
130128 completed : false ,
131- historyItemId : 'abc123' ,
132129 variantAnalysis : createMockVariantAnalysis (
133130 VariantAnalysisStatus . InProgress ,
134131 createMockScannedRepos ( [
@@ -142,9 +139,9 @@ describe('Query history info', () => {
142139 } ) ;
143140 it ( 'should return label when `totalScannedRepositoryCount` is greater than 1' , ( ) => {
144141 const repoLabel = buildRepoLabel ( variantAnalysisHistoryItem ) ;
145-
142+
146143 expect ( repoLabel ) . to . equal ( '2/4 repositories' ) ;
147144 } ) ;
148145 } ) ;
149- } ) ;
146+ } ) ;
150147} ) ;
0 commit comments