// fixtures/sizes.test.mjs — the font-size vocabulary, under plain Node. // // fonts.test.mjs's counterpart. Importing this module is also what makes // sizes.mjs's own module-load guard run in the gate — the same // arrangement align.test.mjs and fonts.test.mjs have, and for the reason // their comments give at length: a guard that only executes when a // browser mounts the editor is dead code in CI, so a drifted vocabulary // would pass the whole gate and then throw for every user. import { test } from 'node:test' import assert from 'node:assert/strict' import { SIZES, DEFAULT_SIZE, SIZE_MARKS, LEGACY_SIZES, sizeMark, sizeForMarks, } from './sizes.mjs' test('the default is offered, is first, and carries no mark', () => { assert.ok(SIZES.includes(DEFAULT_SIZE)) assert.equal(SIZES[0], DEFAULT_SIZE) // The literal null is the assertion, not a derivation of sizeMark's // own definition. fonts.mjs's guard has a long comment about an // assertion that compared a value to itself and could not fail for // any input; this is where that expectation belongs — in a test, // against a literal. assert.equal(sizeMark(DEFAULT_SIZE), null) assert.equal(sizeMark(12), null) }) test('every other size maps to its own mark', () => { assert.equal(sizeMark(8), 'size_8') assert.equal(sizeMark(14), 'size_14') assert.equal(sizeMark(72), 'size_72') }) test('a size string works, because that is what a