← Home ← Back to /g/

Thread 106138355

4 posts 2 images /g/
Anonymous No.106138355 [Report]
>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 No.106138375 [Report] >>106138486
I don't get it. what's the issue?
Anonymous No.106138486 [Report] >>106138543
>>106138375
>anonymous functions for testing
Anonymous No.106138543 [Report]
>>106138486
ok and?