Thread 106138355 - /g/ [Archived: 213 hours ago]

Anonymous
8/4/2025, 5:26:23 PM No.106138355
mfw
mfw
md5: 5906629b0139d8ea1f7eb34e18b6bb33🔍
>JavaScript
// test/math.test.js
import { test, describe } from 'node:test';
import assert from 'node:assert';
import { add, multiply } from '../math.js';

describe('Math functions', () => {
test('adds numbers correctly', () => {
assert.strictEqual(add(2, 3), 5);
});

test('handles async operations', async () => {
const result = await multiply(2, 3);
assert.strictEqual(result, 6);
});

test('throws on invalid input', () => {
assert.throws(() => add('a', 'b'), /Invalid input/);
});
});
Anonymous
8/4/2025, 5:27:40 PM No.106138375
I don't get it. what's the issue?
Replies: >>106138486
Anonymous
8/4/2025, 5:36:26 PM No.106138486
>>106138375
>anonymous functions for testing
Replies: >>106138543
Anonymous
8/4/2025, 5:42:07 PM No.106138543
>>106138486
ok and?