Skip to content

Commit 84416e8

Browse files
broken test + lint
1 parent 8ed6411 commit 84416e8

File tree

7 files changed

+31
-20
lines changed

7 files changed

+31
-20
lines changed

src/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as CONSTANTS from './constants';
66
import { AggregationCursor } from './cursor/aggregation_cursor';
77
import { ListCollectionsCursor } from './cursor/list_collections_cursor';
88
import { RunCommandCursor, type RunCursorCommandOptions } from './cursor/run_command_cursor';
9-
import { MONGODB_ERROR_CODES, MongoInvalidArgumentError, MongoServerError } from './error';
9+
import { MongoInvalidArgumentError } from './error';
1010
import type { MongoClient, PkFactory } from './mongo_client';
1111
import type { Abortable, TODO_NODE_3286 } from './mongo_types';
1212
import type { AggregateOptions } from './operations/aggregate';

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,12 @@ export type {
543543
export type { InsertManyResult, InsertOneOptions, InsertOneResult } from './operations/insert';
544544
export type { CollectionInfo, ListCollectionsOptions } from './operations/list_collections';
545545
export type { ListDatabasesOptions, ListDatabasesResult } from './operations/list_databases';
546-
export type { AbstractOperation, Hint, OperationOptions } from './operations/operation';
546+
export type {
547+
AbstractOperation,
548+
Hint,
549+
ModernizedOperation,
550+
OperationOptions
551+
} from './operations/operation';
547552
export type { ProfilingLevelOptions } from './operations/profiling_level';
548553
export type { RemoveUserOptions } from './operations/remove_user';
549554
export type { RenameOptions } from './operations/rename';

src/operations/command.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
185185
}
186186
}
187187

188+
/** @internal */
188189
export abstract class ModernizedCommandOperation<T> extends ModernizedOperation<T> {
189190
override options: CommandOperationOptions;
190191
readConcern?: ReadConcern;

src/operations/drop.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { MongoServerError } from '..';
12
import type { Document } from '../bson';
23
import { CursorTimeoutContext } from '../cursor/abstract_cursor';
34
import type { Db } from '../db';
5+
import { MONGODB_ERROR_CODES } from '../error';
46
import type { Server } from '../sdam/server';
57
import type { ClientSession } from '../sessions';
68
import { TimeoutContext } from '../timeout';

src/operations/operation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export abstract class AbstractOperation<TResult = any> {
131131
}
132132
}
133133

134+
/** @internal */
134135
export abstract class ModernizedOperation<TResult> extends AbstractOperation<TResult> {
135136
abstract SERVER_COMMAND_RESPONSE_TYPE: typeof MongoDBResponse;
136137

test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,25 @@ describe('Handshake Prose Tests', function () {
162162
let stubCalled = false;
163163
beforeEach(() => {
164164
// Mock the server response in a way that saslSupportedMechs array in the hello command response contains an arbitrary string.
165-
sinon.stub(Connection.prototype, 'command').callsFake(async function (ns, cmd, options) {
166-
// @ts-expect-error: sinon will place wrappedMethod there
167-
const command = Connection.prototype.command.wrappedMethod.bind(this);
168-
if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) {
169-
return stub();
170-
}
171-
return command(ns, cmd, options);
172-
173-
async function stub() {
174-
stubCalled = true;
175-
const response = await command(ns, cmd, options);
176-
return {
177-
...response,
178-
saslSupportedMechs: [...(response.saslSupportedMechs ?? []), 'random string']
179-
};
180-
}
181-
});
165+
sinon
166+
.stub(Connection.prototype, 'command')
167+
.callsFake(async function (ns, cmd, options, responseType) {
168+
// @ts-expect-error: sinon will place wrappedMethod there
169+
const command = Connection.prototype.command.wrappedMethod.bind(this);
170+
if (cmd.hello || cmd[LEGACY_HELLO_COMMAND]) {
171+
return stub();
172+
}
173+
return command(ns, cmd, options, responseType);
174+
175+
async function stub() {
176+
stubCalled = true;
177+
const response = await command(ns, cmd, options, responseType);
178+
return {
179+
...response,
180+
saslSupportedMechs: [...(response.saslSupportedMechs ?? []), 'random string']
181+
};
182+
}
183+
});
182184
});
183185

184186
afterEach(() => sinon.restore());

0 commit comments

Comments
 (0)