File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
packages/mongodb-constants/src Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable mocha/max-top-level-suites */
12import { expect } from 'chai' ;
23import type { Completion } from './filter' ;
3- import { wrapField , getFilteredCompletions } from './filter' ;
4+ import { wrapField , getFilteredCompletions , ALL_CONSTANTS } from './filter' ;
5+ import semver from 'semver' ;
6+ import util from 'util' ;
47
58describe ( 'completer' , function ( ) {
69 const simpleConstants : Completion [ ] = [
@@ -190,4 +193,21 @@ describe('completer', function () {
190193 ) ;
191194 } ) ;
192195 } ) ;
196+
197+ describe ( 'all completions' , function ( ) {
198+ it ( 'should have valid semver version or range specified' , function ( ) {
199+ ALL_CONSTANTS . forEach ( ( { name, version } ) => {
200+ const errMessage = `Expected completion ${ util . inspect ( {
201+ name,
202+ version,
203+ } ) } to have valid version`;
204+
205+ try {
206+ expect ( semver . valid ( version ) ) . to . not . eq ( null , errMessage ) ;
207+ } catch {
208+ expect ( semver . validRange ( version ) ) . to . not . eq ( null , errMessage ) ;
209+ }
210+ } ) ;
211+ } ) ;
212+ } ) ;
193213} ) ;
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