seveibar/pd-dual-stepper-controller
Bottom-side PCB silkscreen artwork consisting of embedded mirrored TS Circuit SVG logos, with via-clearance-aware lower-board placement.
- Version
- 0.1.0
- License
- unset
- Stars
- 0
tests/outer-motor-power.test.tsx
import {expect, test} from "bun:test";
import {readFileSync} from "node:fs";
import {Circuit} from "tscircuit";
import Board from "../index.circuit";
import {assertOuterMotorPower} from "./helpers/assertOuterMotorPower";
test("motor supply, winding and regulation-return copper stays on outer layers", async () => {
let json;
if (process.env.CIRCUIT_JSON_PATH) json=JSON.parse(readFileSync(process.env.CIRCUIT_JSON_PATH,"utf8"));
else {const c=new Circuit();c.add(<Board/>);await c.renderUntilSettled();json=c.getCircuitJson();}
const result=assertOuterMotorPower(json);
expect(result.status).toBe("pass");
const bad=structuredClone(json);
const t=bad.find((e:any)=>e.type==="pcb_trace" && e.pcb_trace_id===result.checkedTraceIds[0]);
t.route.find((p:any)=>p.route_type==="wire").layer="inner1";
expect(()=>assertOuterMotorPower(bad)).toThrow("Motor-current copper on inner layer");
},600000);