imrishabh18/rp2040-motor-controller
This circuit module provides a microcontroller-based NEMA17 stepper motor driver with integrated USB-C Power Delivery, temperature sensing, and safety interlocks.
- Version
- 1.0.16
- License
- unset
- Stars
- 0
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(22);
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);