Skip to content

Commit 5f30592

Browse files
committed
patch
1 parent 1c627eb commit 5f30592

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

tests/repro/repro11.test.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { expect, test } from "bun:test"
2-
import type { CircuitJson, PCBPlatedHole } from "circuit-json"
3-
import * as fs from "node:fs"
4-
import * as path from "node:path"
2+
import type { CircuitJson, PcbPlatedHole } from "circuit-json"
53
import { renderGLTFToPNGBufferFromGLBBuffer } from "poppygl"
64
import { convertCircuitJsonToGltf } from "../../lib"
75
import { getBestCameraPosition } from "../../lib/utils/camera-position"
6+
import circuitJson from "../assets/repro11.json"
87

98
test("repro11 circuit 11 3d snapshot", async () => {
10-
const circuitPath = path.join(__dirname, "../../circuit (11).json")
11-
const circuitData = fs.readFileSync(circuitPath, "utf-8")
12-
const circuitJson: CircuitJson = JSON.parse(circuitData)
13-
const interiorPlatedHole: PCBPlatedHole = {
9+
const interiorPlatedHole: PcbPlatedHole = {
1410
type: "pcb_plated_hole",
1511
pcb_plated_hole_id: "repro11_interior_plated_hole",
1612
x: 0,
@@ -22,22 +18,28 @@ test("repro11 circuit 11 3d snapshot", async () => {
2218
is_covered_with_solder_mask: false,
2319
}
2420

25-
circuitJson.push(interiorPlatedHole)
21+
const circuitJsonWithInteriorPlatedHole: CircuitJson = [
22+
...(circuitJson as CircuitJson),
23+
interiorPlatedHole,
24+
]
2625

27-
const glb = await convertCircuitJsonToGltf(circuitJson, {
28-
format: "glb",
29-
boardTextureResolution: 1024,
30-
includeModels: true,
31-
showBoundingBoxes: false,
32-
})
26+
const glb = await convertCircuitJsonToGltf(
27+
circuitJsonWithInteriorPlatedHole,
28+
{
29+
format: "glb",
30+
boardTextureResolution: 1024,
31+
includeModels: true,
32+
showBoundingBoxes: false,
33+
},
34+
)
3335

3436
expect(glb).toBeInstanceOf(ArrayBuffer)
3537
expect((glb as ArrayBuffer).byteLength).toBeGreaterThan(0)
3638

3739
expect(
3840
renderGLTFToPNGBufferFromGLBBuffer(
3941
glb as ArrayBuffer,
40-
getBestCameraPosition(circuitJson),
42+
getBestCameraPosition(circuitJsonWithInteriorPlatedHole),
4143
),
4244
).toMatchPngSnapshot(import.meta.path, "repro11-circuit-11")
4345
})

0 commit comments

Comments
 (0)