UNPKG

spec-link

Version:

A library for managing test specifications and integrations with test management tools

56 lines 1.78 kB
"use strict"; // sample.test.ts describe('Calculator', () => { let calculator; beforeEach(() => { calculator = { add: (a, b) => a + b, subtract: (a, b) => a - b, }; }); describe('Addition', () => { it('should add two positive numbers correctly', () => { expect(calculator.add(2, 3)).toBe(5); }); it('should handle negative numbers', () => { expect(calculator.add(-1, 1)).toBe(0); }); test('should return the same number when adding zero', () => { expect(calculator.add(5, 0)).toBe(5); }); test.todo('should handle decimal numbers'); }); describe('Subtraction', () => { it('should subtract two positive numbers correctly', () => { expect(calculator.subtract(5, 3)).toBe(2); }); it('should handle negative results', () => { expect(calculator.subtract(1, 3)).toBe(-2); }); test.todo('should handle subtracting zero'); }); describe.skip('Multiplication', () => { it('should multiply two numbers', () => { // This test will be skipped expect(2 * 3).toBe(6); }); }); }); describe('Asynchronous tests', () => { it('should work with async/await', async () => { const result = await Promise.resolve(42); expect(result).toBe(42); }); test('should work with done callback', (done) => { setTimeout(() => { expect(true).toBe(true); done(); }, 100); }); it.todo('should handle rejected promises'); }); test('top-level test', () => { expect(1 + 1).toBe(2); }); test.todo('implement division tests'); //# sourceMappingURL=sample.test.js.map