Conversation
- Add spdip (Shrink DIP) footprint with 1.778mm pitch - Add utdfn (Ultra-Thin DFN) footprint with thermal pad for UTDFN-4-EP(1x1) - Add string normalization for pdip, spdip, and UTDFN-4-EP(1x1) aliases - Add tests for spdip and utdfn footprints - Fix string normalization for sot-223-N and to-220f-N aliases Fixes: Issue tscircuit#371 (PDIP-8 alias), Issue tscircuit#180 (SPDIP-28), Issue tscircuit#183 (UTDFN-4-EP) Note: SOT-223-5 (Issue tscircuit#181) was already implemented
| import { test, expect } from "bun:test" | ||
| import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" | ||
| import { fp } from "../src/footprinter" | ||
| import type { AnyCircuitElement } from "circuit-json" | ||
|
|
||
| test("spdip28", () => { | ||
| const circuitJson = fp | ||
| .string("spdip28") | ||
| .circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "spdip28") | ||
| }) | ||
|
|
||
| test("SPDIP-28 (alias)", () => { | ||
| const aliasSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("SPDIP-28").circuitJson(), | ||
| ) | ||
| const canonicalSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("spdip28").circuitJson(), | ||
| ) | ||
| expect(aliasSvg).toEqual(canonicalSvg) | ||
| }) | ||
|
|
||
| test("spdip8", () => { | ||
| const circuitJson = fp | ||
| .string("spdip8") | ||
| .circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "spdip8") | ||
| }) | ||
|
|
||
| test("spdip default params", () => { | ||
| const json = fp.string("spdip28").json() | ||
| // SPDIP defaults: pitch = 1.778mm (shrink), width = 7.62mm (narrow body) | ||
| expect(json.fn).toBe("spdip") | ||
| expect(json.num_pins).toBe(28) | ||
| expect(json.w).toBe(7.62) | ||
| expect(json.p).toBe(1.778) | ||
| }) |
There was a problem hiding this comment.
This test file contains 4 test() calls, which violates the rule that a *.test.ts file may have AT MOST one test(...). The file should be split into multiple numbered files like spdip1.test.ts, spdip2.test.ts, spdip3.test.ts, and spdip4.test.ts, with each file containing only one test() call.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
| import { test, expect } from "bun:test" | ||
| import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" | ||
| import { fp } from "../src/footprinter" | ||
| import type { AnyCircuitElement } from "circuit-json" | ||
|
|
||
| test("utdfn4", () => { | ||
| const circuitJson = fp | ||
| .string("utdfn4") | ||
| .circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "utdfn4") | ||
| }) | ||
|
|
||
| test("UTDFN-4-EP(1x1) alias", () => { | ||
| const aliasSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("UTDFN-4-EP(1x1)").circuitJson(), | ||
| ) | ||
| const canonicalSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("utdfn4").circuitJson(), | ||
| ) | ||
| expect(aliasSvg).toEqual(canonicalSvg) | ||
| }) | ||
|
|
||
| test("utdfn4 default params", () => { | ||
| const json = fp.string("utdfn4").json() | ||
| // UTDFN-4-EP(1x1) defaults: w=1.0mm, p=0.5mm | ||
| // Note: h is computed from pin layout, not passed as param | ||
| expect(json.fn).toBe("utdfn") | ||
| expect(json.num_pins).toBe(4) | ||
| expect(json.w).toBe(1) | ||
| expect(json.p).toBe(0.5) | ||
| }) |
There was a problem hiding this comment.
This test file contains 3 test() calls, which violates the rule that a *.test.ts file may have AT MOST one test(...). The file should be split into multiple numbered files like utdfn1.test.ts, utdfn2.test.ts, and utdfn3.test.ts, with each file containing only one test() call.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
Summary
This PR adds two new footprints and string aliases:
Changes
SPDIP (Shrink DIP) - Issue Implement SPDIP-28 #180
spdipfunction with pitch = 1.778mm (vs standard 2.54mm)spdip28,spdip8,SPDIP-28etc.UTDFN-4-EP(1x1) - Issue Implement UTDFN-4-EP(1x1) #183
utdfnfunction for Ultra-Thin DFN with exposed thermal padutdfn4,UTDFN-4-EP(1x1)etc.PDIP string alias - Issue Implement PDIP-8 #371
Note
sot223_5Testing