File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,11 @@ describe('completer.completer', function () {
497
497
} ) ;
498
498
499
499
context ( 'when context is aggregation query' , function ( ) {
500
+ it ( 'returns all suggestions' , async function ( ) {
501
+ const i = 'db.shipwrecks.aggregate([{' ;
502
+ expect ( ( await completer ( standalone440 , i ) ) [ 0 ] ) . to . be . an ( 'array' ) ;
503
+ } ) ;
504
+
500
505
it ( 'has several matches' , async function ( ) {
501
506
const i = 'db.shipwrecks.aggregate([ { $so' ;
502
507
expect ( await completer ( standalone440 , i ) ) . to . deep . equal ( [
Original file line number Diff line number Diff line change @@ -290,6 +290,12 @@ export async function completer(
290
290
return [ [ ] , line ] ;
291
291
}
292
292
293
+ // from https://github.com/mongodb-js/devtools-shared/commit/e4a5b00a83b19a76bdf380799a421511230168db
294
+ function satisfiesVersion ( v1 : string , v2 : string ) : boolean {
295
+ const isGTECheck = / ^ \d + ?\. \d + ?\. \d + ?$ / . test ( v2 ) ;
296
+ return semver . satisfies ( v1 , isGTECheck ? `>=${ v2 } ` : v2 ) ;
297
+ }
298
+
293
299
function isAcceptable (
294
300
params : AutocompleteParameters ,
295
301
entry : {
@@ -310,7 +316,10 @@ function isAcceptable(
310
316
! entry [ versionKey ] ||
311
317
// TODO: when https://jira.mongodb.org/browse/SPM-2327 is done we can rely on server_version being present
312
318
! connectionInfo ?. server_version ||
313
- semver . gte ( connectionInfo . server_version , entry [ versionKey ] as string ) ;
319
+ satisfiesVersion (
320
+ connectionInfo . server_version ,
321
+ entry [ versionKey ] as string
322
+ ) ;
314
323
}
315
324
const isAcceptableEnvironment =
316
325
! entry . env ||
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ async function waitEval(bus: MongoshBus) {
73
73
async function waitCompletion ( bus : MongoshBus ) {
74
74
await Promise . race ( [
75
75
waitBus ( bus , 'mongosh:autocompletion-complete' ) ,
76
- new Promise ( ( resolve ) => setTimeout ( resolve , 5000 ) ?. unref ?.( ) ) ,
76
+ new Promise ( ( resolve ) => setTimeout ( resolve , 10_000 ) ?. unref ?.( ) ) ,
77
77
] ) ;
78
78
await tick ( ) ;
79
79
}
You can’t perform that action at this time.
0 commit comments