mohan-bee/fitness-band
A 4-layer BLE wearable mainboard with Li-ion charging/protection, 3.3/1.8 V power regulation, motion and battery sensing, plus a folded 2-layer flex sensor board carrying MAX30102 optical and TMP117 temperature sensors.
- Version
- 0.0.2
- License
- unset
- Stars
- 0
routing/main-routing.test.ts
import { expect, test } from "bun:test"
import { mainRouting } from "./main-routing"
import reference from "./main-reference-input.json"
import nativeRoutes from "./main-native-routes.json"
test("replays every native track and via with the captured geometry", async () => {
const router = await mainRouting(structuredClone(reference))
let traces: { route: unknown }[] = []
router.on("complete", (event: {traces: typeof traces}) => { traces = event.traces })
router.start()
await new Promise(resolve => queueMicrotask(() => resolve(undefined)))
expect(traces.map(trace=>trace.route)).toEqual(nativeRoutes.map(track=>track.route))
})
test("rejects a moved pad", async () => {
const input = structuredClone(reference)
input.connections[0]!.pointsToConnect[0]!.x += 0.1
await expect(mainRouting(input)).rejects.toThrow("geometry or connectivity changed")
})
test("rejects changed connectivity", async () => {
const input = structuredClone(reference)
input.connections[0]!.pointsToConnect.pop()
await expect(mainRouting(input)).rejects.toThrow("geometry or connectivity changed")
})
test("rejects changed obstacles", async () => {
const input = structuredClone(reference)
input.obstacles[0]!.width += 0.1
await expect(mainRouting(input)).rejects.toThrow("geometry or connectivity changed")
})
test("rejects a changed board outline", async () => {
const input = structuredClone(reference)
input.bounds.maxX += 1
await expect(mainRouting(input)).rejects.toThrow("geometry or connectivity changed")
})