Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Oct 9, 2024
1 parent 2702b72 commit 4143a75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
24 changes: 6 additions & 18 deletions src/legacy_wrappers/cursors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ module.exports.makeLegacyFindCursor = function (baseClass) {
return maybeCallback(super.count(options), callback);
}

explain(verbosity, callback) {
callback =
typeof callback === 'function'
? callback
: typeof verbosity === 'function'
? verbosity
: undefined;
verbosity = typeof verbosity !== 'function' ? verbosity : undefined;
return maybeCallback(super.explain(verbosity), callback);
explain(_verbosity, _options, _callback) {

Check failure on line 28 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_verbosity' is defined but never used

Check failure on line 28 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_options' is defined but never used

Check failure on line 28 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_callback' is defined but never used
const callback = Array.from(arguments).find(argument => typeof argument === 'function');
return maybeCallback(super.explain(...arguments), callback);
}

close(options, callback) {
Expand Down Expand Up @@ -180,15 +174,9 @@ module.exports.makeLegacyAggregationCursor = function (baseClass) {
}

class LegacyAggregationCursor extends baseClass {
explain(verbosity, callback) {
callback =
typeof callback === 'function'
? callback
: typeof verbosity === 'function'
? verbosity
: undefined;
verbosity = typeof verbosity !== 'function' ? verbosity : undefined;
return maybeCallback(super.explain(verbosity), callback);
explain(_verbosity, _options, _callback) {

Check failure on line 177 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_verbosity' is defined but never used

Check failure on line 177 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_options' is defined but never used

Check failure on line 177 in src/legacy_wrappers/cursors.js

View workflow job for this annotation

GitHub Actions / check

'_callback' is defined but never used
const callback = Array.from(arguments).find(argument => typeof argument === 'function');
return maybeCallback(super.explain(...arguments), callback);
}

close(options, callback) {
Expand Down
4 changes: 2 additions & 2 deletions test/tools/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const api = [
{ className: 'Admin', method: 'serverStatus', returnType: 'Promise<Document>' },
{ className: 'Admin', method: 'validateCollection', returnType: 'Promise<Document>' },

{ className: 'AggregationCursor', method: 'explain', returnType: 'Promise<Document>' },
{ className: 'AggregationCursor', method: 'explain', returnType: 'Promise<Document>', possibleCallbackPositions: [1, 2, 3] },
{ className: 'AggregationCursor', method: 'clone', returnType: 'AggregationCursor', notAsync: true },

{ className: 'FindCursor', method: 'clone', returnType: 'FindCursor', notAsync: true },
Expand Down Expand Up @@ -115,7 +115,7 @@ const api = [
{ className: 'Db', method: 'watch', returnType: 'ChangeStream', notAsync: true },

{ className: 'FindCursor', method: 'count', returnType: 'Promise<number>' },
{ className: 'FindCursor', method: 'explain', returnType: 'Promise<Document>' },
{ className: 'FindCursor', method: 'explain', returnType: 'Promise<Document>', possibleCallbackPositions: [1,2,3] },

{ className: 'GridFSBucket', method: 'delete', returnType: 'Promise<void>', possibleCallbackPositions: [1, 2] },
{ className: 'GridFSBucket', method: 'drop', returnType: 'Promise<void>', possibleCallbackPositions: [1, 2] },
Expand Down

0 comments on commit 4143a75

Please sign in to comment.