File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
packages/mongodb-constants/src Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 11import { expect } from 'chai' ;
22import type { Completion } from './filter' ;
3- import { wrapField , getFilteredCompletions } from './filter' ;
3+ import { wrapField , getFilteredCompletions , ALL_CONSTANTS } from './filter' ;
4+ import semver from 'semver' ;
5+ import util from 'util' ;
46
57describe ( 'completer' , function ( ) {
68 const simpleConstants : Completion [ ] = [
@@ -190,4 +192,21 @@ describe('completer', function () {
190192 ) ;
191193 } ) ;
192194 } ) ;
195+
196+ describe ( 'all completions' , function ( ) {
197+ it ( 'should have valid semver version or range specified' , function ( ) {
198+ ALL_CONSTANTS . forEach ( ( { name, version } ) => {
199+ const errMessage = `Expected completion ${ util . inspect ( {
200+ name,
201+ version,
202+ } ) } to have valid version`;
203+
204+ try {
205+ expect ( semver . valid ( version ) ) . to . not . eq ( null , errMessage ) ;
206+ } catch {
207+ expect ( semver . validRange ( version ) ) . to . not . eq ( null , errMessage ) ;
208+ }
209+ } ) ;
210+ } ) ;
211+ } ) ;
193212} ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { QUERY_OPERATORS } from './query-operators';
99import { STAGE_OPERATORS } from './stage-operators' ;
1010import { SYSTEM_VARIABLES } from './system-variables' ;
1111
12- const ALL_CONSTANTS = [
12+ export const ALL_CONSTANTS = [
1313 ...ACCUMULATORS ,
1414 ...BSON_TYPES ,
1515 ...BSON_TYPE_ALIASES ,
You can’t perform that action at this time.
0 commit comments