AnasSarkiz/muse-voice-remote
Muse Voice Remote — bare ESP32-S3R8, 155 TOP JLCPCB parts with real supplier CAD, native 3D assembly and GLB exports. Revised 17 mm case allocation; 0.30 mm via drill /0.45 mm pad. Checked prototype PCB; mechanical, RF and MUSE qualification pending.
- Version
- 1.3.2
- License
- unset
- Stars
- 0
tests/assembly.test.ts
import { test } from "node:test"
import assert from "node:assert/strict"
import { readFileSync } from "node:fs"
import { createHash } from "node:crypto"
const report=JSON.parse(readFileSync("docs/assembly-verification.json","utf8"))
const boardBytes=readFileSync("circuit.json")
const board=JSON.parse(boardBytes.toString())
const assembly=JSON.parse(readFileSync("dist/assembly/assembly.circuit.json","utf8"))
test("assembly preserves every verified board record and all imported supplier CAD",()=>{
assert.equal(report.board_source_sha256,createHash("sha256").update(boardBytes).digest("hex"))
assert.deepEqual(assembly.slice(0,board.length),board)
assert.equal(report.supplier_model_types,56)
assert.equal(report.supplier_obj_and_step_sha256_verified,112)
assert.equal(report.supplier_meshes_loaded,155)
assert.equal(report.cad_fallback_boxes,0)
assert.equal(assembly.filter((e:{type:string})=>e.type==="pcb_component").length,155)
const identifiers=assembly.flatMap((e:Record<string,unknown>)=>Object.entries(e).filter(([k])=>k===`${e.type}_id`).map(([,v])=>v))
assert.equal(new Set(identifiers).size,identifiers.length,"No assembly IDs collide with checked board IDs")
})
test("assembly datum and revised pack allocation clear actual supplier bounds",()=>{
assert.equal(report.coordinate_system.pdf_front_to_pcb_centre,4.7)
assert.equal(report.coordinate_system.pcb_top_z,.5)
assert.equal(report.mechanical_revision.proposed_case_depth,17)
assert.deepEqual(report.conservative_battery_intersections,[])
assert.deepEqual(report.conservative_supplier_pair_intersections,[])
assert.deepEqual(report.conservative_transducer_intersections,[])
assert.ok(report.rear_clearance_after_battery_swelling_mm>.6)
assert.equal(report.envelopes.length,6)
assert.ok(report.envelopes.every((e:{name:string})=>e.name.startsWith("ENV_")))
})
test("native 3D exports contain real geometry for every populated reference",()=>{
for(const [file,key] of [["MuseVoiceRemote-assembly.glb","assembly_glb"],["MuseVoiceRemote-populated-pcb.glb","pcb_glb"]]){
const bytes=readFileSync(`dist/assembly/${file}`)
assert.equal(bytes.readUInt32LE(0),0x46546c67)
assert.equal(bytes.readUInt32LE(4),2)
assert.equal(bytes.readUInt32LE(8),bytes.length)
assert.equal(createHash("sha256").update(bytes).digest("hex"),report.outputs[key].sha256)
const gltf=JSON.parse(bytes.subarray(20,20+bytes.readUInt32LE(12)).toString())
const names=new Set(gltf.nodes.map((n:{name:string})=>n.name))
for(const e of report.transformed_supplier_bounds){
assert.ok(names.has(e.reference),`Missing mesh: ${e.reference}`)
const node=gltf.nodes.find((n:{name:string})=>n.name===e.reference)
const mesh=gltf.meshes[node.mesh]
assert.ok(mesh?.primitives.length,`No geometry: ${e.reference}`)
for(const primitive of mesh.primitives)
assert.ok(gltf.accessors[primitive.attributes.POSITION].count>0,`Empty geometry: ${e.reference}`)
}
}
})