imrishabh18/rp2040-motor-controller
Bottom-side PCB silkscreen artwork implementing mirrored tsCircuit logos as embedded SVG paths, with via-clearance-aware placement and no active electronics.
- Version
- 1.0.41
- License
- unset
- Stars
- 5
tests/common-ground.test.tsx
import { expect, test } from "bun:test";
import { Circuit } from "tscircuit";
import Rp2040MotorController from "../index.circuit";
import { assertCommonGround } from "./helpers/assertCommonGround";
test("all grounds and mounting rings share connectivity; a missing ground connection is detected", async () => {
const circuit = new Circuit({ platform: { pcbDisabled: true } });
circuit.add(<Rp2040MotorController routingDisabled />);
await circuit.renderUntilSettled();
const json = circuit.getCircuitJson();
expect(assertCommonGround(json).checkedGroundPorts).toBe(40);
expect(json.filter((e) => (e.type === "schematic_net_label" || e.type === "schematic_text") &&
e.text === "GND" && e.display_superscript)).toEqual([]);
// Removing a real ground connection must fail despite matching GND names.
const withoutTestPointGround = json.filter(e => !(e.type === "source_trace" && e.name === "TP_G"));
expect(() => assertCommonGround(withoutTestPointGround)).toThrow();
}, 60_000);