Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/basics/basics06/basics06.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ test("basics06: skip mesh generation when all components have model_step_url", a

expect(stepText).toContain("CYLINDRICAL_SURFACE")

// Should have multiple solids: board + 2 external STEP components
// Should have exactly the board plus the two unique external STEP models.
// A weaker >= check would miss regressions that drop or duplicate model solids.

const solidCount = (stepText.match(/MANIFOLD_SOLID_BREP/g) || []).length

expect(solidCount).toBeGreaterThanOrEqual(3)
expect(solidCount).toBe(3)

// Write STEP file to debug-output

Expand Down
9 changes: 5 additions & 4 deletions test/repros/kicad-step/kicad-step.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const EXPECTED_UNIQUE_STEP_MODEL_COUNT = new Set(
.filter((item) => item.type === "cad_component" && item.model_step_url)
.map((item) => item.model_step_url),
).size
const EXPECTED_SOLID_COUNT = 1 + EXPECTED_UNIQUE_STEP_MODEL_COUNT

const fixturesDir = fileURLToPath(
new URL("../../fixtures/kicad-models/", import.meta.url),
Expand Down Expand Up @@ -109,7 +110,9 @@ test("kicad-step: merges KiCad STEP models referenced via model_step_url", async

expect(stepText).toContain("KiCadStepMerge")
const solidCount = (stepText.match(/MANIFOLD_SOLID_BREP/g) || []).length
expect(solidCount).toBeGreaterThanOrEqual(3)
// The STEP merge should define one board solid and one reusable solid per
// unique external model. Component instances are MAPPED_ITEM references.
expect(solidCount).toBe(EXPECTED_SOLID_COUNT)

const repository = parseRepository(stepText)
const solids = Array.from(repository.entries())
Expand All @@ -123,9 +126,7 @@ test("kicad-step: merges KiCad STEP models referenced via model_step_url", async
)
expect(boardSolids.length).toBe(1)
const uniqueComponentSolids = solids.length - boardSolids.length
expect(uniqueComponentSolids).toBeGreaterThanOrEqual(
EXPECTED_UNIQUE_STEP_MODEL_COUNT,
)
expect(uniqueComponentSolids).toBe(EXPECTED_UNIQUE_STEP_MODEL_COUNT)
expect(stepText.match(/MAPPED_ITEM/g) ?? []).toHaveLength(
EXPECTED_COMPONENT_CENTERS.length,
)
Expand Down
Loading