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
1 change: 1 addition & 0 deletions src/footprinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const normalizeDefinition = (def: string): string => {
return def
.trim()
.replace(/^pinheader(?=[\d_]|$)/i, "pinrow")
.replace(/^spdip-?(\d+)(?=_|$)/i, "dip$1")
.replace(/^sot23-(\d+)(?=_|$)/i, "sot23_$1")
.replace(/^sot-223-(\d+)(?=_|$)/i, "sot223_$1")
.replace(/^to-220f-(\d+)(?=_|$)/i, "to220f_$1")
Expand Down
16 changes: 13 additions & 3 deletions tests/dip.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from "bun:test"
import { expect, test } from "bun:test"
import type { AnyCircuitElement } from "circuit-json"
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { fp } from "../src/footprinter"
import type { AnyCircuitElement } from "circuit-json"

test("dip footprint", () => {
const circuitJson = fp().dip(4).w(4).p(2).circuitJson()
Expand All @@ -20,6 +20,16 @@ test("DIP16 string resolves using lowercase function", () => {
const lowercaseJson = fp.string("dip16").json()
expect(uppercaseJson).toEqual(lowercaseJson)
})

test("SPDIP-28 aliases resolve to dip28", () => {
const spdipJson = fp.string("SPDIP-28").json()
const compactSpdipJson = fp.string("spdip28").json()
const dipJson = fp.string("dip28").json()

expect(spdipJson).toEqual(dipJson)
expect(compactSpdipJson).toEqual(dipJson)
})

test("dip16 with nosquareplating", () => {
const circuitJson = fp
.string("dip16_nosquareplating")
Expand Down Expand Up @@ -81,7 +91,7 @@ test("dip4", () => {

test("dip8_p1.27mm", () => {
const circuitJson = fp.string("dip8_p1.27mm").circuitJson()
let svgContent = convertCircuitJsonToPcbSvg(circuitJson)
const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "dip8_p1.27mm")
})

Expand Down
Loading