1
- // /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
2
-
3
1
import { expect } from 'chai' ;
4
2
5
3
import {
@@ -116,8 +114,8 @@ describe('MongoErrors', () => {
116
114
} ) ;
117
115
118
116
describe ( 'MongoSystemError#constructor' , ( ) => {
119
- context ( 'when the topology description contains a code' , ( ) => {
120
- it ( 'contains the code as a top level property' , ( ) => {
117
+ context ( 'when the topology description contains an error code' , ( ) => {
118
+ it ( 'contains the specified code as a top level property' , ( ) => {
121
119
const topologyDescription = {
122
120
error : {
123
121
code : 123
@@ -129,8 +127,8 @@ describe('MongoErrors', () => {
129
127
} ) ;
130
128
} ) ;
131
129
132
- context ( 'when the topology description does not contain a code' , ( ) => {
133
- it ( 'contains the code as a top level property' , ( ) => {
130
+ context ( 'when the topology description does not contain an error code' , ( ) => {
131
+ it ( 'contains the code as a top level property that is undefined ' , ( ) => {
134
132
const topologyDescription = { error : { } } as any as TopologyDescription ;
135
133
136
134
const error = new MongoSystemError ( 'something went wrong' , topologyDescription ) ;
@@ -139,7 +137,7 @@ describe('MongoErrors', () => {
139
137
} ) ;
140
138
141
139
context ( 'when the topology description does not contain an error property' , ( ) => {
142
- it ( 'contains the code as a top level property' , ( ) => {
140
+ it ( 'contains the code as a top level property that is undefined ' , ( ) => {
143
141
const topologyDescription = { } as any as TopologyDescription ;
144
142
145
143
const error = new MongoSystemError ( 'something went wrong' , topologyDescription ) ;
@@ -262,7 +260,8 @@ describe('MongoErrors', () => {
262
260
expect ( getSymbolFrom ( errorWithOptionFalse , 'beforeHandshake' , false ) ) . to . be . a ( 'symbol' ) ;
263
261
264
262
const errorWithBadOption = new MongoNetworkError ( '' , {
265
- beforeHandshake : 'not boolean' as any
263
+ // @ts -expect-error: beforeHandshake must be a boolean value
264
+ beforeHandshake : 'not boolean'
266
265
} ) ;
267
266
expect ( getSymbolFrom ( errorWithBadOption , 'beforeHandshake' , false ) ) . to . be . an ( 'undefined' ) ;
268
267
0 commit comments