Make Via layer refs optional and add layers array; update schema and tests#668
Merged
Merged
Conversation
Comment on lines
+24
to
+40
| test("should parse ViaProps with layers and net assignability flag", () => { | ||
| const raw: ViaProps = { | ||
| name: "v2", | ||
| layers: ["top", "bottom"], | ||
| holeDiameter: "0.25mm", | ||
| outerDiameter: "0.6mm", | ||
| netIsAssignable: true, | ||
| } | ||
|
|
||
| expectTypeOf(raw).toMatchTypeOf<z.input<typeof viaProps>>() | ||
|
|
||
| const parsed = viaProps.parse(raw) | ||
| expect(parsed.layers).toEqual(["top", "bottom"]) | ||
| expect(parsed.holeDiameter).toBe(0.25) | ||
| expect(parsed.outerDiameter).toBe(0.6) | ||
| expect(parsed.netIsAssignable).toBe(true) | ||
| }) |
Contributor
There was a problem hiding this comment.
The style guide states that a *.test.ts file may have AT MOST one test(...) call. This file now contains at least two test(...) blocks (the pre-existing one ending at line 22 and the newly added one starting at line 24). The new test should be moved into a separate, numbered file — for example via2.test.ts — so that each test file contains only a single test(...) call.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
Contributor
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
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.
Motivation
layersarray or omit explicitfromLayer/toLayerto support more flexible layer declarations and maintain backwards compatibility.Description
ViaPropsto makefromLayerandtoLayeroptional and add an optionallayers?: LayerRefInput[]property inlib/components/via.ts.viaPropsto markfromLayer/toLayeras optional and addlayers: z.array(layer_ref).optional()for runtime validation.README.md,generated/COMPONENT_TYPES.md, andgenerated/PROPS_OVERVIEW.mdto reflect the updatedViaPropsshape.tests/via.test.tsto validate parsing oflayersandnetIsAssignable, and keep the existing test forfromLayer/toLayer.Testing
bun testand the updatedtests/via.test.tsexecuted successfully.expectTypeOfagainstz.input<typeof viaProps>passed in the tests.Codex Task