shibosoftwaredev/f1c100s-linux-nema17-stepper-controller
A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.
- Version
- 0.4.56
- License
- unset
- Stars
- 0
tests/clean-schematic.test.ts
import { test, expect } from "bun:test"
import fs from "node:fs"
import {originalSourceContract,stablePhysicalContract} from "./software-current-contract"
const read=(file:string)=>JSON.parse(fs.readFileSync(file,"utf8")) as any[]
const before=read("baseline/circuit.json"),after=read("dist/index/circuit.json")
const hardware=(c:any[])=>c.filter(e=>!e.type.startsWith("schematic_")&&!e.type.endsWith("_warning")&&e.type!=="source_project_metadata")
test("original source and component geometry are preserved except the explicit software-current addition and reference-resistor move",()=>{
originalSourceContract(before,after)
stablePhysicalContract({before,after})
})
test("no schematic symbol or represented source terminal is lost during relayout",()=>{
for(const type of ["schematic_component","schematic_port"]) {
const key=type==="schematic_component"?"source_component_id":"source_port_id"
const original=before.filter(e=>e.type===type).map(e=>e[key]).sort()
const originalIds=new Set(original)
expect(after.filter(e=>e.type===type&&originalIds.has(e[key])).map(e=>e[key]).sort()).toEqual(original)
}
})
test("all pages use a consistent A4 frame with local headings, no detached documentation cards",()=>{
const sheets=after.filter(e=>e.type==="schematic_sheet")
expect(sheets.length).toBe(13)
// A native symbol may contain rectangles (e.g. the RJ45 magnetics). Only
// detached documentation rectangles are prohibited by this page layout.
expect(after.filter(e=>e.type==="schematic_rect"&&!e.schematic_component_id)).toEqual([])
for(const sheet of sheets) {
expect(sheet.sheet_size).toBe("a4")
const text=after.filter(e=>e.type==="schematic_text"&&e.schematic_sheet_id===sheet.schematic_sheet_id)
expect(text.some(e=>e.text==="F1C100S / NEMA 17")).toBe(true)
expect(text.some(e=>e.text.startsWith("Sheet "))).toBe(true)
expect(text.filter(e=>e.font_size===.32||e.font_size===.36).length).toBeGreaterThanOrEqual(2)
}
expect(after.filter(e=>e.type==="schematic_element_outside_sheet_warning")).toEqual([])
})