A test that fails for the right reason
JavascriptAssert on the message, not merely that something threw. A typo raising TypeError would otherwise pass.
import { test } from 'node:test';
import assert from 'node:assert/strict';
test('rejects a negative amount', () => {
assert.throws(
() => new Money(-1),
{ name: 'RangeError', message: /cannot be negative/ }
);
});