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.14
- 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 ground domains share electrical connectivity, and the missing join 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(18);
expect(json.filter((e) => (e.type === "schematic_net_label" || e.type === "schematic_text") &&
e.text === "GND" && e.display_superscript)).toEqual([]);
// Recreate the original omission. Same-name labels and stale connectivity
// keys must not make the disconnected source network appear connected.
const withoutJoin = json.filter((e) => !(e.type === "source_trace" && e.name === "BOARD_GND_JOIN"));
expect(() => assertCommonGround(withoutJoin)).toThrow("Disconnected GND networks");
}, 60_000);