krishnax12/watchy-eink-smartwatch
Unfinished prototype (not production-ready): 4 native DRC errors, 2 display-flex intersections, and missing antenna radiator copper remain
- Version
- 1.2.7
- License
- MIT
- Stars
- 1
scripts/automatic-schematic.test.ts
import { expect, test } from "bun:test";
test("schematic placement and trace paths are not manually specified", async () => {
const files = ["index.circuit.tsx"];
for (const directory of [
"schematic",
"imports",
"footprints",
"routing",
"pcb",
]) {
for await (const file of new Bun.Glob("**/*.tsx").scan(directory)) {
files.push(`${directory}/${file}`);
}
}
for (const file of files) {
const source = await Bun.file(file).text();
expect(source, file).not.toMatch(/\bsch(?:X|Y|Rotation|TracePath)\s*=/);
expect(source, file).not.toMatch(/schematic_placements\s*:/);
}
const board = await Bun.file("index.circuit.tsx").text();
expect(board).toContain("schAutoLayoutEnabled");
expect(board).toContain("schLayout={{ matchAdapt: true }}");
expect(board).toContain("routingDisabled = false");
expect(board).toContain('autorouter="auto_local"');
const sheets = await Bun.file("schematic/SchematicSheets.tsx").text();
expect(sheets.match(/<schematicsheet\b/g)).toHaveLength(4);
expect(sheets.match(/<schematicsection\b/g)).toHaveLength(13);
expect(sheets.match(/<schematicsection\b[^>]*\bdisplayName=/g)).toHaveLength(
13,
);
const routing = await Bun.file("routing/CrystalRfRouting.tsx").text();
expect(routing).not.toMatch(/\bpcbPath\s*=|<autoroutingphase\b/);
});