imrishabh18/rp2040-motor-controller
This circuit incorporates a USB-C Power Delivery (PD) interface with a CH224K controller, a WJ500V-5.08-04P motor output connector, multiple power conditioning components including capacitors, resistors, diodes, and an RP2040 microcontroller, to manage motor control, signal routing, and power management for a USB-powered stepper motor system.
- 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);