Restore hyphenated SOT-23 aliases - #762
Merged
Merged
Conversation
Comment on lines
+11
to
+33
| test("sot-23 legacy alias", () => { | ||
| const circuitJson = fp.string("sot-23").circuitJson() | ||
| expect(circuitJson).toEqual(fp.string("sot23").circuitJson()) | ||
|
|
||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias") | ||
| }) | ||
|
|
||
| test("sot-23 pin-count aliases", () => { | ||
| const aliases = [ | ||
| ["sot-23-3", "sot23_3"], | ||
| ["sot-23-5", "sot23_5"], | ||
| ["sot-23-6", "sot23_6"], | ||
| ] as const | ||
|
|
||
| for (const [alias, canonical] of aliases) { | ||
| const circuitJson = fp.string(alias).circuitJson() | ||
| expect(circuitJson).toEqual(fp.string(canonical).circuitJson()) | ||
|
|
||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, alias) | ||
| } | ||
| }) |
Contributor
There was a problem hiding this comment.
This file now contains more than one test(...) call, which violates the rule that a *.test.ts file may have AT MOST one test(...). The two new tests ('sot-23 legacy alias' on line 11 and 'sot-23 pin-count aliases' on line 19) should be split into separate numbered files, e.g., sot231.test.ts, sot232.test.ts, sot233.test.ts (or similar numbering scheme consistent with the project).
Suggested change
| test("sot-23 legacy alias", () => { | |
| const circuitJson = fp.string("sot-23").circuitJson() | |
| expect(circuitJson).toEqual(fp.string("sot23").circuitJson()) | |
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | |
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias") | |
| }) | |
| test("sot-23 pin-count aliases", () => { | |
| const aliases = [ | |
| ["sot-23-3", "sot23_3"], | |
| ["sot-23-5", "sot23_5"], | |
| ["sot-23-6", "sot23_6"], | |
| ] as const | |
| for (const [alias, canonical] of aliases) { | |
| const circuitJson = fp.string(alias).circuitJson() | |
| expect(circuitJson).toEqual(fp.string(canonical).circuitJson()) | |
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | |
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, alias) | |
| } | |
| }) | |
| test("sot-23 legacy alias", () => { | |
| const circuitJson = fp.string("sot-23").circuitJson() | |
| expect(circuitJson).toEqual(fp.string("sot23").circuitJson()) | |
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | |
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "sot23_legacy_alias") | |
| }) | |
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.
Summary
sot-23footprint strings.sot-23,sot-23-3,sot-23-5, andsot-23-6to their canonical SOT-23 definitions.Root cause
The RJ45 footprint parser change allowed
-to begin a parameter value so signed values such asholey-3.43mmwork. Before normalization, that causedsot-23to be parsed assot("-23"); the generic six-pin SOT parser then failed validation instead of selecting the standard SOT-23 footprint.This keeps signed parameter parsing intact while handling the hyphenated SOT-23 family as aliases before tokenization.
Validation
bun test tests/sot23.test.ts(9 passing)bun run buildgit diff --checkmelf,sod323fl,diode1210,diode0603,sod923).