implement TO-220 horizontal variant#534
Closed
victorjzq wants to merge 1 commit intotscircuit:mainfrom
Closed
Conversation
Contributor
Author
|
Duplicate of #533, closing this one. |
Comment on lines
+1
to
+40
| import { test, expect } from "bun:test" | ||
| import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" | ||
| import { fp } from "src/footprinter" | ||
|
|
||
| test("to220h_3", () => { | ||
| const circuitJson = fp.string("to220h_3").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
|
|
||
| expect(circuitJson).toBeDefined() | ||
| expect(circuitJson.length).toBeGreaterThan(0) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "to220h_3") | ||
| }) | ||
|
|
||
| test("to220h_3_tabup", () => { | ||
| const circuitJson = fp.string("to220h_3_tabup").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
|
|
||
| expect(circuitJson).toBeDefined() | ||
| expect(circuitJson.length).toBeGreaterThan(0) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "to220h_3_tabup") | ||
| }) | ||
|
|
||
| test("to220h_2", () => { | ||
| const circuitJson = fp.string("to220h_2").circuitJson() | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
|
|
||
| expect(circuitJson).toBeDefined() | ||
| expect(circuitJson.length).toBeGreaterThan(0) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "to220h_2") | ||
| }) | ||
|
|
||
| test("TO-220H-3 (alias)", () => { | ||
| const aliasSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("TO-220H-3").circuitJson(), | ||
| ) | ||
| const canonicalSvg = convertCircuitJsonToPcbSvg( | ||
| fp.string("to220h_3").circuitJson(), | ||
| ) | ||
| expect(aliasSvg).toEqual(canonicalSvg) | ||
| }) |
Contributor
There was a problem hiding this comment.
This test file contains 4 test() calls (lines 5, 14, 23, and 32), but according to the style guide rule, a *.test.ts file may have AT MOST one test(...) function. After that, the user should split into multiple, numbered files. To fix this, split the tests into separate files like: to220h1.test.ts, to220h2.test.ts, to220h3.test.ts, and to220h4.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/claim #185
Added the TO-220H (horizontal) footprint variant, which was missing despite TO-220 being a very common through-hole package. The implementation generates plated holes centered on y=0 with the body extending upward, and supports a
tabupparameter to render the mounting tab on the silkscreen — I made sure the ref text shifts up accordingly when the tab is present so it doesn't overlap. Pitch auto-computes from body width when pins exceed 2 to handle wider variants correctly.Fixes #185