units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. @juanlizarazog
specification •Group of expectations (that test the state of the code). •spec -> test test('adds 1 + 1 to equal 2', () => { expect(sum(1, 1)).toBe(2); });
specification •Group of expectations (that test the state of the code). •spec -> test it('adds 1 + 1 to equal 2', () => { expect(sum(1, 1)).toBe(2); });
{ expect(sum(1, 2)).toBe(3); }); function sum(a, b) { // return b + a; // return a + b; // return Number.parseInt(a, 10) + Number.parseInt(b, 10); // or anything else, we just care that the result is the sum }