1
- 'use strict ';
1
+ import { expect } from 'chai ';
2
2
3
- const mock = require ( '../../tools/mongodb-mock/index' ) ;
4
- const { expect } = require ( 'chai' ) ;
5
- const { MongoServerSelectionError, MongoClient } = require ( '../../mongodb' ) ;
6
- const { isHello } = require ( '../../mongodb' ) ;
3
+ import {
4
+ isHello ,
5
+ MAX_SUPPORTED_WIRE_VERSION ,
6
+ MIN_SUPPORTED_WIRE_VERSION ,
7
+ MongoClient ,
8
+ MongoServerSelectionError
9
+ } from '../../mongodb' ;
10
+ import * as mock from '../../tools/mongodb-mock/index' ;
7
11
8
12
const minCompatErrMsg = `minimum wire version ${
9
13
Number . MAX_SAFE_INTEGER - 1
10
- } , but this version of the Node.js Driver requires at most 21 `;
11
- const maxCompatErrMsg = `reports maximum wire version 1, but this version of the Node.js Driver requires at least 6 ` ;
14
+ } , but this version of the Node.js Driver requires at most ${ MAX_SUPPORTED_WIRE_VERSION } `;
15
+ const maxCompatErrMsg = `reports maximum wire version 1, but this version of the Node.js Driver requires at least ${ MIN_SUPPORTED_WIRE_VERSION } ` ;
12
16
13
17
describe ( 'Wire Protocol Version' , ( ) => {
14
- /** @type {mock.MockServer } */
15
- let server , client ;
18
+ let server , client : MongoClient ;
16
19
17
20
function setWireProtocolMessageHandler ( min , max ) {
18
21
server . setMessageHandler ( req => {
@@ -41,7 +44,6 @@ describe('Wire Protocol Version', () => {
41
44
it ( 'should raise a compatibility error' , async function ( ) {
42
45
setWireProtocolMessageHandler ( Number . MAX_SAFE_INTEGER - 1 , Number . MAX_SAFE_INTEGER ) ;
43
46
44
- /** @type {MongoClient } */
45
47
client = new MongoClient (
46
48
`mongodb://${ server . uri ( ) } /wireVersionTest?serverSelectionTimeoutMS=200`
47
49
) ;
@@ -59,7 +61,6 @@ describe('Wire Protocol Version', () => {
59
61
it ( 'should raise a compatibility error' , async function ( ) {
60
62
setWireProtocolMessageHandler ( 1 , 1 ) ;
61
63
62
- /** @type {MongoClient } */
63
64
client = new MongoClient (
64
65
`mongodb://${ server . uri ( ) } /wireVersionTest?serverSelectionTimeoutMS=200`
65
66
) ;
0 commit comments