У меня есть файл js (index.js), как показано ниже
function index() {
sum(a,b) {
return a+b;
};
test() {
---
---
}
};
В моем файле test.js (с использованием jest)
const index = require('./index');
console.log(index)
test('adds 1 + 2 to equal 3', () => {
expect(index.sum(1, 2)).toBe(3);
});
Это ошибка выкидывания
Ошибка типа: index.sum не является функцией