release: WRNexusJS 0.6.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { parse } from "../../compiler/src/index.ts";
|
||||
|
||||
const componentsDir = join(import.meta.dir, "..", "components");
|
||||
|
||||
@@ -166,7 +167,13 @@ describe("@wrnexus/ui redesign component pack", () => {
|
||||
|
||||
for (const [name, tokens] of Object.entries(expectations)) {
|
||||
const source = await readFile(join(componentsDir, `${name}.wrn`), "utf8");
|
||||
for (const token of tokens) expect(source).toContain(token);
|
||||
const ast = parse(source);
|
||||
const defaults = new Map(ast.props.map((prop) => [prop.name, prop.default]));
|
||||
for (const token of tokens) {
|
||||
const match = /^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/.exec(token);
|
||||
expect(match).not.toBeNull();
|
||||
expect(defaults.get(match![1]!)).toBe(match![2]!);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user