简单的求和函数测试不能开玩笑

时间:2019-02-11 08:37:47

标签: javascript testing jestjs

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(4);
});

即使给出错误,也完全从jest文档中复制了此错误! https://jestjs.io/docs/en/getting-started

错误屏幕截图

error screenshot

0 个答案:

没有答案