import test from 'node:test'; import assert from 'node:assert/strict'; import { add } from '../src/add.mjs'; test('positive additions return the actual sum', () => assert.equal(add(2, 3), 5)); test('negative additions preserve the signed result', () => assert.equal(add(-3, 1), -2)); test('fractional additions retain numeric precision', () => assert.ok(Math.abs(add(0.1, 0.2) - 0.3) < 1e-12)); test('nonfinite and nonnumeric inputs are rejected', () => { for (const pair of [[Infinity, 1], ['2', 3], [NaN, 1]]) assert.throws(() => add(...pair), TypeError); });