Timeout de brincadeira
beforeEach(function () {
jest.setTimeout(2000) // ms
});
gaz_edge
beforeEach(function () {
jest.setTimeout(2000) // ms
});
test.each([
{a: 1, b: 1, expected: 2},
{a: 1, b: 2, expected: 3},
{a: 2, b: 1, expected: 3},
])('.add($a, $b)', ({a, b, expected}) => {
expect(a + b).toBe(expected);
});
const cal = require('../index');
test('adds 1 + 2 to equal 3', () => {
expect(cal.sum(1, 2)).toBe(3);
expect(cal.sum(1, 2)).not.toBe(4);
expect(cal.sum(1, 2)).toBeGreaterThan(2);
expect(cal.sum(1, 2)).toBeLessThan(4);
expect(cal.sum(1, 2)).toBeCloseTo(3);
// Testing datatype
expect(typeof cal.sum(1, 2)).toBe("number");
});