@@ -36,7 +36,7 @@ class TestSearchEngine implements ISearchEngine<IRawFileMatch> {
3636
3737 private isCanceled = false ;
3838
39- constructor ( private result : ( ) => IRawFileMatch , public config ?: IFileQuery ) {
39+ constructor ( private result : ( ) => IRawFileMatch | null , public config ?: IFileQuery ) {
4040 TestSearchEngine . last = this ;
4141 }
4242
@@ -94,10 +94,7 @@ suite('RawSearchService', () => {
9494 test ( 'Individual results' , async function ( ) {
9595 this . timeout ( testTimeout ) ;
9696 let i = 5 ;
97- const Engine = TestSearchEngine . bind ( null , ( ) => {
98- i -- ;
99- return rawMatch ;
100- } ) ;
97+ const Engine = TestSearchEngine . bind ( null , ( ) => i -- ? rawMatch : null ) ;
10198 const service = new RawSearchService ( ) ;
10299
103100 let results = 0 ;
@@ -117,10 +114,7 @@ suite('RawSearchService', () => {
117114 test ( 'Batch results' , async function ( ) {
118115 this . timeout ( testTimeout ) ;
119116 let i = 25 ;
120- const Engine = TestSearchEngine . bind ( null , ( ) => {
121- i -- ;
122- return rawMatch ;
123- } ) ;
117+ const Engine = TestSearchEngine . bind ( null , ( ) => i -- ? rawMatch : null ) ;
124118 const service = new RawSearchService ( ) ;
125119
126120 const results : number [ ] = [ ] ;
@@ -143,10 +137,7 @@ suite('RawSearchService', () => {
143137 this . timeout ( testTimeout ) ;
144138 const uriPath = '/some/where' ;
145139 let i = 25 ;
146- const Engine = TestSearchEngine . bind ( null , ( ) => {
147- i -- ;
148- return rawMatch ;
149- } ) ;
140+ const Engine = TestSearchEngine . bind ( null , ( ) => i -- ? rawMatch : null ) ;
150141 const service = new RawSearchService ( ) ;
151142
152143 function fileSearch ( config : IFileQuery , batchSize : number ) : Event < ISerializedSearchProgressItem | ISerializedSearchComplete > {
@@ -271,10 +262,7 @@ suite('RawSearchService', () => {
271262 test ( 'Sorted result batches' , async function ( ) {
272263 this . timeout ( testTimeout ) ;
273264 let i = 25 ;
274- const Engine = TestSearchEngine . bind ( null , ( ) => {
275- i -- ;
276- return rawMatch ;
277- } ) ;
265+ const Engine = TestSearchEngine . bind ( null , ( ) => i -- ? rawMatch : null ) ;
278266 const service = new RawSearchService ( ) ;
279267
280268 const results : number [ ] = [ ] ;
0 commit comments