Skip to content

Commit

Permalink
fix lint and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Aug 23, 2024
1 parent 3347d44 commit 0617065
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ export type { RunCursorCommandOptions } from './cursor/run_command_cursor';
export type { DbOptions, DbPrivate } from './db';
export type { Encrypter, EncrypterOptions } from './encrypter';
export type { AnyError, ErrorDescription, MongoNetworkErrorOptions } from './error';
export type { Explain, ExplainOptions, ExplainVerbosityLike } from './explain';
export type {
Explain,
ExplainCommandOptions,
ExplainOptions,
ExplainVerbosityLike
} from './explain';
export type {
GridFSBucketReadStreamOptions,
GridFSBucketReadStreamOptionsWithRevision,
Expand Down
15 changes: 7 additions & 8 deletions test/integration/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ function dropCollection(dbObj, collectionName, options = {}) {
* @returns a function that collects the specified comment events
*/
function filterForCommands(commands, bag) {
const predicate =
typeof commands === 'function'
? commands
: command => {
const specifiedCommandNames = [commands].flat();
return specifiedCommandNames.includes(command.commandName);
};
if (typeof commands === 'function') {
return function (event) {
if (commands(event.commandName)) bag.push(event);
};
}
commands = Array.isArray(commands) ? commands : [commands];
return function (event) {
if (predicate(event.commandName)) bag.push(event);
if (commands.indexOf(event.commandName) !== -1) bag.push(event);
};
}

Expand Down

0 comments on commit 0617065

Please sign in to comment.