diff --git a/tests/repros/repro61-unnamed-chips.test.tsx b/tests/repros/repro61-unnamed-chips.test.tsx new file mode 100644 index 000000000..b56f407e8 --- /dev/null +++ b/tests/repros/repro61-unnamed-chips.test.tsx @@ -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( + + {/* @ts-expect-error - Testing unnamed chip fallback naming */} + + + {/* @ts-expect-error - Testing unnamed chip fallback naming */} + + + , + ) + + 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"]) +})