Open
Conversation
Comment on lines
+7
to
+121
| test("parse hole with pad stackup defaults hole offset to 0", () => { | ||
| const hole = pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "circle", | ||
| hole_diameter: 0.3, | ||
| x: 1, | ||
| y: 2, | ||
| layers: ["top", "bottom"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "rect", | ||
| width: 0.9, | ||
| height: 0.7, | ||
| ccw_rotation: 15, | ||
| }, | ||
| }, | ||
| { | ||
| layer: "bottom", | ||
| shape: { | ||
| type: "polygon", | ||
| pad_outline: [ | ||
| { x: -0.4, y: -0.3 }, | ||
| { x: 0.4, y: -0.3 }, | ||
| { x: 0, y: 0.5 }, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| }) as PcbHoleWithPadStackup | ||
|
|
||
| expect(hole.hole_offset_x).toBe(0) | ||
| expect(hole.hole_offset_y).toBe(0) | ||
| expect(hole.pad_stackup[0]?.shape).toEqual({ | ||
| type: "rect", | ||
| width: 0.9, | ||
| height: 0.7, | ||
| ccw_rotation: 15, | ||
| }) | ||
| expect(hole.pad_stackup[1]?.shape.type).toBe("polygon") | ||
| }) | ||
|
|
||
| test("hole with pad stackup requires hole dimensions for non-circular holes", () => { | ||
| expect(() => | ||
| pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "oval", | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "circle", | ||
| outer_diameter: 0.6, | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ).toThrow() | ||
| }) | ||
|
|
||
| test("hole with pad stackup requires rotation for rotated pill holes", () => { | ||
| expect(() => | ||
| pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "rotated_pill", | ||
| hole_width: 0.4, | ||
| hole_height: 0.9, | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "pill", | ||
| width: 0.6, | ||
| height: 0.9, | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ).toThrow() | ||
|
|
||
| const rotatedPillHole = pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "rotated_pill", | ||
| hole_width: 0.4, | ||
| hole_height: 0.9, | ||
| hole_ccw_rotation: 45, | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "rotated_pill", | ||
| width: 0.6, | ||
| height: 0.9, | ||
| ccw_rotation: 90, | ||
| }, | ||
| }, | ||
| ], | ||
| }) as PcbHoleWithPadStackup | ||
|
|
||
| expect(rotatedPillHole.hole_ccw_rotation).toBe(45) | ||
| }) |
Contributor
There was a problem hiding this comment.
This test file contains 3 test() calls (lines 7, 51, and 73), but according to the style guide rule about test file organization, 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: pcb_hole_with_pad_stackup1.test.ts, pcb_hole_with_pad_stackup2.test.ts, and pcb_hole_with_pad_stackup3.test.ts, with each file containing only one test() call.
Spotted by Graphite Agent (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
Contributor
Author
|
CC @Abse2001 |
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
Testing
Codex Task