krishnax12/usb-c-control-dial

USB-C control dial PCB with an EC11 push encoder and a 16-LED ring for volume and brightness controls. Work in progress; firmware not included and not fabrication-ready.

Version
0.0.3
License
unset
Stars
1

tests/board.test.ts

import { expect, test } from "bun:test"
import { runAllChecks } from "@tscircuit/checks"
import type { AnyCircuitElement } from "circuit-json"

const circuitJson: AnyCircuitElement[] = await Bun.file(
  new URL("../outputs/repro/circuit.json", import.meta.url),
).json()

test("saved native export contains the routed board and sixteen LED openings", () => {
  expect(
    circuitJson.filter((element) => element.type === "pcb_trace").length,
  ).toBeGreaterThan(0)
  expect(
    circuitJson.filter((element) => element.type === "pcb_cutout"),
  ).toHaveLength(16)
  expect(
    circuitJson.filter((element) => element.type === "schematic_component")
      .length,
  ).toBeGreaterThan(0)
})

test("saved native export has no embedded errors or warnings", () => {
  expect(
    circuitJson.filter((element) => /error|warning/.test(element.type)),
  ).toEqual([])
})

test("independent PCB, schematic, netlist and pin checks pass", async () => {
  expect(await runAllChecks(circuitJson)).toEqual([])
})