Skip to content

Commit d14c4d1

Browse files
committed
fix: variable name
1 parent 69ffa9e commit d14c4d1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

test/tools/api.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ const transformMethods = [
146146
module.exports.asyncApi = asyncApi;
147147
module.exports.transformMethods = transformMethods;
148148
module.exports.asyncApiClasses = new Set(asyncApi.map(({className}) => className))
149-
module.exports.classesToMethods = new Map([...asyncApi, ...transformMethods].map((api, _, array) =>
150-
[api.className, new Set(array.filter(v => v.className === api.className))]
151-
));
149+
module.exports.classNameToMethodList = new Map([...asyncApi, ...transformMethods].map((api, _, array) => {
150+
const methodNames = Array.from(new Set(Array.from(array.filter(v => v.className === api.className), ({ method }) => method)))
151+
methodNames.sort((a, b) => a.localeCompare(b))
152+
return [api.className, methodNames]
153+
}));

test/unit/index.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { expect } = require('chai');
44
const mdbLegacy = require('../..');
55
const mdbDriver = require('mongodb');
6-
const { asyncApiClasses, classesToMethods } = require('../tools/api');
6+
const { asyncApiClasses, classNameToMethodList } = require('../tools/api');
77

88
describe('index.js', () => {
99
it('should export everything mongodb does', () => {
@@ -18,11 +18,8 @@ describe('index.js', () => {
1818
}
1919

2020
describe('subclass for legacy callback support', () => {
21-
for (const [className, methods] of classesToMethods) {
21+
for (const [className, methodNames] of classNameToMethodList) {
2222
describe(`class ${className}`, () => {
23-
const methodNames = Array.from(new Set(Array.from(methods, ({ method }) => method)));
24-
methodNames.sort((a, b) => String.prototype.localeCompare.call(a, b));
25-
2623
for (const method of methodNames) {
2724
it(`should define override ${method}()`, () => {
2825
expect(mdbLegacy[className].prototype)

0 commit comments

Comments
 (0)