Files
stack/packages/bus/tests/address.test.mjs
2026-10-23 23:57:31 -05:00

18 lines
786 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { parseAddress } from '../src/address.mjs';
import { addressCases } from './address-cases.mjs';
for (const [label, input, expected] of addressCases) {
test(`parseAddress: ${label}`, () => assert.deepEqual(parseAddress(input), expected));
}
test('parseAddress rejects non-text without coercion', () => {
for (const input of [null, undefined, {}, 1]) assert.throws(() => parseAddress(input), TypeError);
});
// mos-1567: new coverage, separate from the pre-existing broker import pin.
test('the mounted address parser has no import dependency', () => {
assert.doesNotMatch(readFileSync(new URL('../src/address.mjs', import.meta.url), 'utf8'), /\bimport\b/);
});