@@ -659,44 +659,46 @@ describe('query-history', () => {
659659 historyTreeDataProvider . dispose ( ) ;
660660 } ) ;
661661
662- it ( 'should get a tree item with raw results' , async ( ) => {
663- const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , true , /* raw results */ false ) ) ;
664- const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
665- expect ( treeItem . command ) . to . deep . eq ( {
666- title : 'Query History Item' ,
667- command : 'codeQLQueryHistory.itemClicked' ,
668- arguments : [ mockQuery ] ,
669- tooltip : labelProvider . getLabel ( mockQuery ) ,
662+ describe ( 'getTreeItem' , async ( ) => {
663+ it ( 'should get a tree item with raw results' , async ( ) => {
664+ const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , true , /* raw results */ false ) ) ;
665+ const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
666+ expect ( treeItem . command ) . to . deep . eq ( {
667+ title : 'Query History Item' ,
668+ command : 'codeQLQueryHistory.itemClicked' ,
669+ arguments : [ mockQuery ] ,
670+ tooltip : labelProvider . getLabel ( mockQuery ) ,
671+ } ) ;
672+ expect ( treeItem . label ) . to . contain ( 'hucairz' ) ;
673+ expect ( treeItem . contextValue ) . to . eq ( 'rawResultsItem' ) ;
674+ expect ( treeItem . iconPath ) . to . deep . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/drive.svg' ) . fsPath ) ;
670675 } ) ;
671- expect ( treeItem . label ) . to . contain ( 'hucairz' ) ;
672- expect ( treeItem . contextValue ) . to . eq ( 'rawResultsItem' ) ;
673- expect ( treeItem . iconPath ) . to . deep . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/drive.svg' ) . fsPath ) ;
674- } ) ;
675676
676- it ( 'should get a tree item with interpreted results' , async ( ) => {
677- const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , true , /* interpreted results */ true ) ) ;
678- const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
679- expect ( treeItem . contextValue ) . to . eq ( 'interpretedResultsItem' ) ;
680- expect ( treeItem . iconPath ) . to . deep . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/drive.svg' ) . fsPath ) ;
681- } ) ;
677+ it ( 'should get a tree item with interpreted results' , async ( ) => {
678+ const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , true , /* interpreted results */ true ) ) ;
679+ const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
680+ expect ( treeItem . contextValue ) . to . eq ( 'interpretedResultsItem' ) ;
681+ expect ( treeItem . iconPath ) . to . deep . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/drive.svg' ) . fsPath ) ;
682+ } ) ;
682683
683- it ( 'should get a tree item that did not complete successfully' , async ( ) => {
684- const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , false ) , false ) ;
685- const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
686- expect ( treeItem . iconPath ) . to . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/red-x.svg' ) . fsPath ) ;
687- } ) ;
684+ it ( 'should get a tree item that did not complete successfully' , async ( ) => {
685+ const mockQuery = createMockLocalQuery ( 'a' , createMockQueryWithResults ( sandbox , false ) , false ) ;
686+ const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
687+ expect ( treeItem . iconPath ) . to . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/red-x.svg' ) . fsPath ) ;
688+ } ) ;
688689
689- it ( 'should get a tree item that failed before creating any results' , async ( ) => {
690- const mockQuery = createMockLocalQuery ( 'a' , undefined , true ) ;
691- const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
692- expect ( treeItem . iconPath ) . to . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/red-x.svg' ) . fsPath ) ;
693- } ) ;
690+ it ( 'should get a tree item that failed before creating any results' , async ( ) => {
691+ const mockQuery = createMockLocalQuery ( 'a' , undefined , true ) ;
692+ const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
693+ expect ( treeItem . iconPath ) . to . eq ( vscode . Uri . file ( mockExtensionLocation + '/media/red-x.svg' ) . fsPath ) ;
694+ } ) ;
694695
695- it ( 'should get a tree item that is in progress' , async ( ) => {
696- const mockQuery = createMockLocalQuery ( 'a' ) ;
697- const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
698- expect ( treeItem . iconPath ) . to . deep . eq ( {
699- id : 'sync~spin' , color : undefined
696+ it ( 'should get a tree item that is in progress' , async ( ) => {
697+ const mockQuery = createMockLocalQuery ( 'a' ) ;
698+ const treeItem = await historyTreeDataProvider . getTreeItem ( mockQuery ) ;
699+ expect ( treeItem . iconPath ) . to . deep . eq ( {
700+ id : 'sync~spin' , color : undefined
701+ } ) ;
700702 } ) ;
701703 } ) ;
702704
0 commit comments