Skip to content

Commit 954fcbb

Browse files
JLHwungmathiasbynens
authored andcommitted
Declare the generated root index as a default export
Assisted-By: GPT-6 Issue: #110
1 parent 51db4f3 commit 954fcbb

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/tests.mjs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ if (!process.env.CI) {
2121
// Format fixtures mock the data reader, so register them after generation.
2222
await import('./parser-formats.mjs');
2323

24+
test('Root declarations match the default runtime export', async (t) => {
25+
for (const version of [oldest, newest]) {
26+
const module = await import(`../output/unicode-${version}/index.mjs`);
27+
t.assert.deepEqual(Object.keys(module), ['default']);
28+
const declaration = fs.readFileSync(
29+
new URL(`../output/unicode-${version}/index.d.mts`, import.meta.url),
30+
'utf8',
31+
);
32+
t.assert.match(declaration, /export\s+default\s+\w+\s*;/);
33+
t.assert.doesNotMatch(declaration, /export\s+const\s/);
34+
for (const property of Object.keys(module.default)) {
35+
t.assert.match(
36+
declaration,
37+
new RegExp(`\\b${property}:\\s*string\\[\\]`),
38+
);
39+
}
40+
}
41+
});
42+
2443
// Every mapping `symbols.mjs` must equal its `code-points.mjs` with each code
2544
// point replaced by the corresponding symbol.
2645
const assertSymbolsMatchCodePoints = async (t, version) => {

0 commit comments

Comments
 (0)