Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| const a = arrangement as ExplicitPinMappingArrangement | ||
| return ( | ||
| a.leftSide !== undefined || | ||
| a.rightSide !== undefined || | ||
| a.topSide !== undefined || | ||
| a.bottomSide !== undefined | ||
| ) |
There was a problem hiding this comment.
The variable a is too short and non-descriptive for a cast representation of arrangement. Consider using a more meaningful name such as explicitArrangement to improve code readability and make the intent clearer. This would be more consistent with the naming conventions used elsewhere in the codebase.
| const a = arrangement as ExplicitPinMappingArrangement | |
| return ( | |
| a.leftSide !== undefined || | |
| a.rightSide !== undefined || | |
| a.topSide !== undefined || | |
| a.bottomSide !== undefined | |
| ) | |
| const explicitArrangement = arrangement as ExplicitPinMappingArrangement | |
| return ( | |
| explicitArrangement.leftSide !== undefined || | |
| explicitArrangement.rightSide !== undefined || | |
| explicitArrangement.topSide !== undefined || | |
| explicitArrangement.bottomSide !== undefined | |
| ) |
Spotted by Diamond (based on custom rules)
Is this helpful? React 👍 or 👎 to let us know.
| import { test, expect } from "bun:test" | ||
| import { getTestFixture } from "../fixtures/get-test-fixture" | ||
|
|
||
| export default test("pinheader right side direction", async () => { | ||
| const { circuit } = getTestFixture() | ||
|
|
||
| circuit.add( | ||
| <board width="10mm" height="10mm"> | ||
| <pinheader | ||
| name="J2" | ||
| pinCount={3} | ||
| facingDirection="right" | ||
| schPinArrangement={{ | ||
| rightSide: { | ||
| direction: "top-to-bottom", | ||
| pins: ["pin1", "pin2", "pin3"], | ||
| }, | ||
| }} | ||
| /> | ||
| <pinheader | ||
| name="J3" | ||
| pinCount={3} | ||
| schX={5} | ||
| facingDirection="right" | ||
| schPinArrangement={{ | ||
| rightSide: { | ||
| direction: "bottom-to-top", | ||
| pins: ["pin1", "pin2", "pin3"], | ||
| }, | ||
| }} | ||
| /> | ||
| </board>, | ||
| ) | ||
|
|
||
| await circuit.renderUntilSettled() | ||
|
|
||
| const ports = circuit.db.schematic_port.list() | ||
| const comp1 = ports | ||
| .filter((p) => p.schematic_component_id === "schematic_component_0") | ||
| .sort((a, b) => b.center.y - a.center.y) | ||
| .map((p) => p.pin_number) | ||
| const comp2 = ports | ||
| .filter((p) => p.schematic_component_id === "schematic_component_1") | ||
| .sort((a, b) => b.center.y - a.center.y) | ||
| .map((p) => p.pin_number) | ||
|
|
||
| expect(comp1).toEqual([1, 2, 3]) | ||
| expect(comp2).toEqual([3, 2, 1]) | ||
|
|
||
| expect(circuit).toMatchSchematicSnapshot(import.meta.path) | ||
| }) |
There was a problem hiding this comment.
The filename repro20-pinheader-rightSide-direction.test.tsx uses camelCase in the middle of the name, which is inconsistent with the project's kebab-case naming convention. For better consistency with the codebase, consider renaming it to repro20-pinheader-right-side-direction.test.tsx.
Spotted by Diamond (based on custom rules)
Is this helpful? React 👍 or 👎 to let us know.
| expect(comp1).toEqual([1, 2, 3]) | ||
| expect(comp2).toEqual([3, 2, 1]) | ||
|
|
||
| expect(circuit).toMatchSchematicSnapshot(import.meta.path) |
There was a problem hiding this comment.
This snapshot is cut off i think unfortunately, maybe stack vertically?
There was a problem hiding this comment.
Removed this, it's an AI generated test file. I have the test in other file which verify the fix
Summary
Testing
bun x tsc --noEmit(fails: Reached heap limit Allocation failed - JavaScript heap out of memory)bun test tests/repros/repro20-pinheader-rightSide-direction.test.tsxhttps://chatgpt.com/codex/tasks/task_b_684af12d168483279bb71d1c229081ed
/close #842