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
2 changes: 1 addition & 1 deletion src/fn/fpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { base_def } from "../helpers/zod/base_def"

export const fpc_def = base_def.extend({
fn: z.literal("fpc"),
num_pins: z.coerce.number().int().min(2),
num_pins: z.coerce.number().int().min(2).default(12),
p: length.default("0.5mm").describe("contact pad pitch"),
pw: length.default("0.3mm").describe("contact pad width"),
pl: length.default("1.25mm").describe("contact pad length"),
Expand Down
18 changes: 18 additions & 0 deletions tests/fpc-bare-string.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test, expect } from "bun:test"
import { fp } from "../src"

test("fpc bare string defaults to 12 pins without throwing (#786)", () => {
const circuitJson = fp.string("fpc").circuitJson()

const smtpads = circuitJson.filter((e) => e.type === "pcb_smtpad")
// 12 contact pads + 2 mounting pads = 14 pads
expect(smtpads.length).toBe(14)
})

test("fpc with explicit pin count parses correctly", () => {
const circuitJson = fp.string("fpc6").circuitJson()

const smtpads = circuitJson.filter((e) => e.type === "pcb_smtpad")
// 6 contact pads + 2 mounting pads = 8 pads
expect(smtpads.length).toBe(8)
})
Loading