• 1000
ReferenceError: main is not defined
У меня один индекс. js с:
async function main() {
function comparer(otherArray) {
return function (current) {
return otherArray.filter(function (other) {
return other.prm === current.prm && other.conso_prod === current.conso_prod
}).length === 0;
}
}
}
module.exports = main();
и в моем тестовом. js файле, у меня есть:
const {expect} = require('chai');
describe('Sum numbers', () => {
it('Compare 2 existing array', () => {
const meters = []
const perimeter = []
const onlyInMeters = meters.filter(main.comparer(perimeter));
expect(onlyInMeters).to.equal([]);
});
});
Но когда Ссылаюсь на main.comparer
, не могу найти:
ReferenceError: main is not defined
Что я забыл? Извини, я NodeJS нуб!