-
Notifications
You must be signed in to change notification settings - Fork 81
Fix autorouter routing through board outline, Add autorouter U-outline regression snapshot #1431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix autorouter routing through board outline, Add autorouter U-outline regression snapshot #1431
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
import { expect, test } from "bun:test" | ||
import { getTestFixture } from "tests/fixtures/get-test-fixture" | ||
import { getSimpleRouteJsonFromCircuitJson } from "lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson" | ||
|
||
const uShapedOutline = [ | ||
{ x: -6, y: -6 }, | ||
{ x: -2, y: -6 }, | ||
{ x: -2, y: 2 }, | ||
{ x: 2, y: 2 }, | ||
{ x: 2, y: -6 }, | ||
{ x: 6, y: -6 }, | ||
{ x: 6, y: 6 }, | ||
{ x: -6, y: 6 }, | ||
] | ||
|
||
test("simple route json includes board outline when provided", async () => { | ||
const { circuit } = getTestFixture() | ||
|
||
circuit.add( | ||
<board | ||
outline={uShapedOutline} | ||
autorouter={{ | ||
local: true, | ||
groupMode: "subcircuit", | ||
}} | ||
> | ||
<resistor | ||
name="R1" | ||
resistance="1k" | ||
footprint="0402" | ||
pcbX={-4} | ||
pcbY={-4} | ||
/> | ||
<resistor name="R2" resistance="1k" footprint="0402" pcbX={4} pcbY={-4} /> | ||
<trace from=".R1 > .pin2" to=".R2 > .pin2" /> | ||
</board>, | ||
) | ||
|
||
await circuit.renderUntilSettled() | ||
|
||
const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({ | ||
db: circuit.db, | ||
}) | ||
|
||
expect(simpleRouteJson.outline).toBeDefined() | ||
expect(simpleRouteJson.outline).toHaveLength(uShapedOutline.length) | ||
expect(simpleRouteJson.outline).toEqual(uShapedOutline) | ||
|
||
expect(circuit).toMatchPcbSnapshot(import.meta.path) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test file name simple-route-json-outline.test.tsx
violates the project's naming convention. Test files with the *.test.ts
extension may contain at most one test(...)
function. When multiple tests are needed, they should be split into numbered files (e.g., add1.test.ts
, add2.test.ts
). Since this file contains only one test, it should be renamed to follow the convention, such as simple-route-json-outline1.test.tsx
or use a more descriptive name that reflects the specific test's purpose.
Spotted by Diamond (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68df59bb16c0832e829d0a91fc50736c