File tree Expand file tree Collapse file tree 2 files changed +23
-21
lines changed Expand file tree Collapse file tree 2 files changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -82,23 +82,24 @@ describe('TrackedTreeView', () => {
8282 )
8383 trackedTreeView . initialize ( mockedDvcRoots )
8484
85- const getRootPathItem = ( dvcRoot : string ) => ( {
86- dvcRoot,
87- isDirectory : true ,
88- resourceUri : Uri . file ( dvcRoot )
89- } )
90-
91- mockedGetChildren . mockImplementation ( dvcRoot => [
92- getRootPathItem ( dvcRoot )
93- ] )
94-
9585 const rootElements = await trackedTreeView . getChildren ( )
9686
97- expect ( rootElements ) . toStrictEqual ( mockedDvcRoots . map ( getRootPathItem ) )
98- expect ( mockedGetRepository ) . toBeCalledTimes ( 2 )
99- expect ( mockedGetRepository ) . toBeCalledWith ( dvcDemoPath )
100- expect ( mockedGetRepository ) . toBeCalledWith ( mockedOtherRoot )
101- expect ( mockedGetChildren ) . toBeCalledTimes ( 2 )
87+ expect ( rootElements ) . toStrictEqual ( [
88+ {
89+ dvcRoot : dvcDemoPath ,
90+ isDirectory : true ,
91+ isTracked : true ,
92+ resourceUri : Uri . file ( dvcDemoPath )
93+ } ,
94+ {
95+ dvcRoot : mockedOtherRoot ,
96+ isDirectory : true ,
97+ isTracked : true ,
98+ resourceUri : Uri . file ( mockedOtherRoot )
99+ }
100+ ] )
101+ expect ( mockedGetRepository ) . toBeCalledTimes ( 0 )
102+ expect ( mockedGetChildren ) . toBeCalledTimes ( 0 )
102103 } )
103104
104105 it ( 'should return directories first in the list of root items' , async ( ) => {
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export class TrackedExplorerTree
112112 this . repositories . treeDataChanged . fire ( )
113113 }
114114
115- private async getRootElements ( ) {
115+ private getRootElements ( ) {
116116 if ( ! this . viewed ) {
117117 sendViewOpenedTelemetryEvent (
118118 EventName . VIEWS_TRACKED_EXPLORER_TREE_OPENED ,
@@ -126,11 +126,12 @@ export class TrackedExplorerTree
126126 return this . getRepoChildren ( onlyRoot )
127127 }
128128
129- const rootChildren = await Promise . all (
130- this . dvcRoots . map ( dvcRoot => this . getRepoChildren ( dvcRoot ) )
131- )
132-
133- return rootChildren . flat ( )
129+ return this . dvcRoots . map ( dvcRoot => ( {
130+ dvcRoot,
131+ isDirectory : true ,
132+ isTracked : true ,
133+ resourceUri : Uri . file ( dvcRoot )
134+ } ) )
134135 }
135136
136137 private getDataPlaceholder ( { fsPath } : { fsPath : string } ) : string {
You can’t perform that action at this time.
0 commit comments