14
tests/index.test.js
Normal file
14
tests/index.test.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../src/index");
|
||||
const vitest_1 = require("vitest");
|
||||
(0, vitest_1.test)('sum adds numbers', () => {
|
||||
(0, vitest_1.expect)((0, index_1.sum)(2, 3)).toBe(5);
|
||||
});
|
||||
(0, vitest_1.test)('isEven detects even numbers', () => {
|
||||
(0, vitest_1.expect)((0, index_1.isEven)(4)).toBe(true);
|
||||
(0, vitest_1.expect)((0, index_1.isEven)(5)).toBe(false);
|
||||
});
|
||||
(0, vitest_1.test)('reverse reverses string', () => {
|
||||
(0, vitest_1.expect)((0, index_1.reverse)('hello')).toBe('olleh');
|
||||
});
|
||||
15
tests/index.test.ts
Normal file
15
tests/index.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { sum, isEven, reverse } from '../src/index';
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
test('sum adds numbers', () => {
|
||||
expect(sum(2, 3)).toBe(5);
|
||||
});
|
||||
|
||||
test('isEven detects even numbers', () => {
|
||||
expect(isEven(4)).toBe(true);
|
||||
expect(isEven(5)).toBe(false);
|
||||
});
|
||||
|
||||
test('reverse reverses string', () => {
|
||||
expect(reverse('hello')).toBe('olleh');
|
||||
});
|
||||
Reference in New Issue
Block a user