lundi 11 février 2019

Simple sum function test not working in jest

q.js : - /src/q.js

function sum(a, b) {
  return a + b;
}

module.exports = sum;

q.test.js : - /tests/q.test.js

const sum = require('../src/q');

test('adds 1 + 2 to equal 3', () => {
  const result = sum(1, 3);
  expect(result).toBe(3);
});

Even this gives an error, this is exactly copied from the jest documentation! https://jestjs.io/docs/en/getting-started

error screenshot:

error screenshot

Aucun commentaire:

Enregistrer un commentaire