Skip to content

Commit 019d7a7

Browse files
committed
daria's comments
1 parent 3392dbf commit 019d7a7

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

global.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ declare global {
5151
interface Test {
5252
metadata: MongoDBMetadataUI;
5353

54-
/** @deprecated Attach spec to a test if you need access to it in a beforeEach hook, not recommended?? */
5554
spec: Record<string, any>;
5655
}
5756

test/integration/retryable-writes/retryable_writes.spec.prose.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('Retryable Writes Spec Prose', () => {
5353
.catch(error => error);
5454

5555
expect(error).to.exist;
56-
expect(error).to.be.instanceOf(MongoServerError);
56+
expect(error).that.is.instanceOf(MongoServerError);
5757
expect(error).to.have.property('originalError').that.instanceOf(MongoError);
5858
expect(error.originalError).to.have.property('code', 20);
5959
expect(error).to.have.property(

test/unit/error.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ describe('MongoErrors', () => {
406406
// 8 - below server version 4.4
407407
// 9 - above server version 4.4
408408

409+
const ABOVE_4_4 = 9;
410+
const BELOW_4_4 = 8;
411+
409412
const tests: {
410413
description: string;
411414
result: boolean;
@@ -416,25 +419,25 @@ describe('MongoErrors', () => {
416419
description: 'a plain error',
417420
result: false,
418421
error: new Error('do not retry me!'),
419-
maxWireVersion: 8
422+
maxWireVersion: BELOW_4_4
420423
},
421424
{
422425
description: 'a MongoError with no code nor label',
423426
result: false,
424427
error: new MongoError('do not retry me!'),
425-
maxWireVersion: 8
428+
maxWireVersion: BELOW_4_4
426429
},
427430
{
428431
description: 'network error',
429432
result: true,
430433
error: new MongoNetworkError('socket bad, try again'),
431-
maxWireVersion: 8
434+
maxWireVersion: BELOW_4_4
432435
},
433436
{
434437
description: 'a MongoWriteConcernError with no code nor label',
435438
result: false,
436439
error: new MongoWriteConcernError({ message: 'empty wc error' }),
437-
maxWireVersion: 8
440+
maxWireVersion: BELOW_4_4
438441
},
439442
{
440443
description: 'a MongoWriteConcernError with a random label',
@@ -443,31 +446,31 @@ describe('MongoErrors', () => {
443446
{ message: 'random label' },
444447
{ errorLabels: ['myLabel'] }
445448
),
446-
maxWireVersion: 8
449+
maxWireVersion: BELOW_4_4
447450
},
448451
{
449452
description: 'a MongoWriteConcernError with a retryable code above server 4.4',
450453
result: false,
451454
error: new MongoWriteConcernError({}, { code: 262 }),
452-
maxWireVersion: 9
455+
maxWireVersion: ABOVE_4_4
453456
},
454457
{
455458
description: 'a MongoWriteConcernError with a retryable code below server 4.4',
456459
result: true,
457460
error: new MongoWriteConcernError({}, { code: 262 }),
458-
maxWireVersion: 8
461+
maxWireVersion: BELOW_4_4
459462
},
460463
{
461464
description: 'a MongoWriteConcernError with a RetryableWriteError label below server 4.4',
462465
result: true,
463466
error: new MongoWriteConcernError({}, { errorLabels: ['RetryableWriteError'] }),
464-
maxWireVersion: 8
467+
maxWireVersion: BELOW_4_4
465468
},
466469
{
467470
description: 'a MongoWriteConcernError with a RetryableWriteError label above server 4.4',
468471
result: false,
469472
error: new MongoWriteConcernError({}, { errorLabels: ['RetryableWriteError'] }),
470-
maxWireVersion: 9
473+
maxWireVersion: ABOVE_4_4
471474
},
472475
{
473476
description: 'any MongoError with a RetryableWriteError label',
@@ -479,7 +482,7 @@ describe('MongoErrors', () => {
479482
error.addErrorLabel('RetryableWriteError');
480483
return error;
481484
})(),
482-
maxWireVersion: 9
485+
maxWireVersion: ABOVE_4_4
483486
}
484487
];
485488
for (const { description, result, error, maxWireVersion } of tests) {

0 commit comments

Comments
 (0)