Skip to content
Closed
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
46 changes: 46 additions & 0 deletions tests/repros/repro61-unnamed-chips.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { expect, test } from "bun:test"
import { getTestFixture } from "../fixtures/get-test-fixture"

test("unnamed chips receive sequential unnamed_chip fallback names", async () => {
const { circuit } = getTestFixture()

circuit.add(
<board width="15mm" height="10mm">
{/* @ts-expect-error - Testing unnamed chip fallback naming */}
<chip
footprint="soic8"
schHeight={2}
schWidth={2}
pinLabels={{
pin1: ["A1"],
pin2: ["A2"],
}}
/>

{/* @ts-expect-error - Testing unnamed chip fallback naming */}
<chip
schHeight={2}
schWidth={2}
footprint="pinrow8"
pinLabels={{
pin1: ["A1"],
pin2: ["A2"],
}}
/>
<trace from=".unnamed_chip1 > .pin1" to=".unnamed_chip2 > .pin1" />
</board>,
)

await circuit.renderUntilSettled()

const circuitJson = circuit.getCircuitJson()

// Explicitly check the names of the created source components.
const sourceComponents = circuitJson.filter(
(e: any) => e.type === "source_component" && e.ftype === "simple_chip",
)
const names = sourceComponents.map((c: any) => c.name).sort()

expect(sourceComponents).toHaveLength(2)
expect(names).toEqual(["unnamed_chip1", "unnamed_chip2"])
})