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/fn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ export { sot343 } from "./sot343"
export { m2host } from "./m2host"
export { mountedpcbmodule } from "./mountedpcbmodule"
export { to92l } from "./to92l"
export { sc70 } from "./sc70"
27 changes: 27 additions & 0 deletions src/fn/sc70.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { AnyCircuitElement } from "circuit-json"
import type { z } from "zod"
import { sot323, type sot323_def } from "./sot323"

/**
* SC-70 footprint — JEDEC MO-203 / SOT-323 package (same physical package).
*
* Defaults match the SC-70-3 (3-pin) package:
* body: 2.0mm × 1.25mm, pitch: 0.65mm
*
* The SC-70 name is an alias for SOT-323; the underlying layout is identical.
* Use `sc70` or `sc70_3` for the 3-pin variant.
*/
export const sc70 = (
raw_params: z.input<typeof sot323_def> & { string?: string },
): { circuitJson: AnyCircuitElement[]; parameters: any } => {
// Apply SC-70 defaults (JEDEC MO-203 / KiCad SOT-323 dimensions)
const params = {
w: "2.0mm",
h: "1.25mm",
pl: "0.6mm",
pw: "0.35mm",
p: "1.1mm",
...raw_params,
}
return sot323(params)
}
1 change: 1 addition & 0 deletions src/footprinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export type Footprinter = {
solderjumper: (
num_pins?: number,
) => FootprinterParamsBuilder<"bridged" | "p" | "pw" | "ph">
sc70: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">

params: () => any
/** @deprecated use circuitJson() instead */
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/sc70.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/__snapshots__/sc70_3.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/__snapshots__/sc70_custom.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions tests/sc70.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test, expect } from "bun:test"
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { fp } from "../src/footprinter"

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

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

test("sc70 custom params", () => {
const circuitJson = fp
.string("sc70_w2.0mm_h1.25mm_p0.65mm")
.circuitJson()
const svgContent = convertCircuitJsonToPcbSvg(circuitJson)
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sc70_custom")
})
Comment on lines +5 to +23
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file contains 3 test() calls (lines 5, 11, and 17), which violates the rule that a *.test.ts file may have AT MOST one test(...). After that, the user should split into multiple, numbered files. This file should be split into separate files like sc701.test.ts, sc702.test.ts, and sc703.test.ts, with each file containing only one test() call.

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Loading