-
Notifications
You must be signed in to change notification settings - Fork 26
Add pill
shape for the pcb_hole
#290
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
Conversation
import { expect, test } from "bun:test" | ||
import { pcb_hole, type PcbHoleOval } from "../src/pcb/pcb_hole" | ||
|
||
test("parse circle hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "circle", | ||
hole_diameter: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) | ||
|
||
expect(hole.hole_shape).toBe("circle") | ||
expect(hole.hole_diameter).toBe(1.5) | ||
}) | ||
|
||
test("parse square hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "square", | ||
hole_diameter: 2.0, | ||
x: 0, | ||
y: 0, | ||
}) | ||
|
||
expect(hole.hole_shape).toBe("square") | ||
expect(hole.hole_diameter).toBe(2.0) | ||
}) | ||
|
||
test("parse oval hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "oval", | ||
hole_width: 3.0, | ||
hole_height: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("oval") | ||
expect(hole.hole_width).toBe(3.0) | ||
expect(hole.hole_height).toBe(1.5) | ||
}) | ||
|
||
test("parse pill hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
}) | ||
|
||
test("parse pill hole with optional properties", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 1.5, | ||
y: -1.0, | ||
pcb_group_id: "group_1", | ||
subcircuit_id: "subcircuit_1", | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
expect(hole.x).toBe(1.5) | ||
expect(hole.y).toBe(-1.0) | ||
expect(hole.pcb_group_id).toBe("group_1") | ||
expect(hole.subcircuit_id).toBe("subcircuit_1") | ||
}) |
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.
This test file contains 5 test functions (lines 4, 17, 30, 45, and 60), which violates the rule that a *.test.ts file may have AT MOST one test(...). The file should be split into multiple numbered files such as pcb_hole1.test.ts, pcb_hole2.test.ts, pcb_hole3.test.ts, pcb_hole4.test.ts, and pcb_hole5.test.ts, with each file containing only one test function.
Spotted by Diamond (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
import { expect, test } from "bun:test" | ||
import { pcb_hole, type PcbHoleOval } from "../src/pcb/pcb_hole" | ||
|
||
test("parse circle hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "circle", | ||
hole_diameter: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) | ||
|
||
expect(hole.hole_shape).toBe("circle") | ||
expect(hole.hole_diameter).toBe(1.5) | ||
}) | ||
|
||
test("parse square hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "square", | ||
hole_diameter: 2.0, | ||
x: 0, | ||
y: 0, | ||
}) | ||
|
||
expect(hole.hole_shape).toBe("square") | ||
expect(hole.hole_diameter).toBe(2.0) | ||
}) | ||
|
||
test("parse oval hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "oval", | ||
hole_width: 3.0, | ||
hole_height: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("oval") | ||
expect(hole.hole_width).toBe(3.0) | ||
expect(hole.hole_height).toBe(1.5) | ||
}) | ||
|
||
test("parse pill hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
}) | ||
|
||
test("parse pill hole with optional properties", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 1.5, | ||
y: -1.0, | ||
pcb_group_id: "group_1", | ||
subcircuit_id: "subcircuit_1", | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
expect(hole.x).toBe(1.5) | ||
expect(hole.y).toBe(-1.0) | ||
expect(hole.pcb_group_id).toBe("group_1") | ||
expect(hole.subcircuit_id).toBe("subcircuit_1") | ||
}) |
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.
This test file contains 5 test functions and violates the constraint that *.test.ts
files may contain at most one test(...)
function. Split this file into separate numbered files: pcb_hole1.test.ts
, pcb_hole2.test.ts
, pcb_hole3.test.ts
, pcb_hole4.test.ts
, and pcb_hole5.test.ts
, with each file containing exactly one test function.
Spotted by Diamond (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
test("parse circle hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "circle", | ||
hole_diameter: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleCircleOrSquare | ||
|
||
expect(hole.hole_shape).toBe("circle") | ||
expect(hole.hole_diameter).toBe(1.5) | ||
}) | ||
|
||
test("parse square hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "square", | ||
hole_diameter: 2.0, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleCircleOrSquare | ||
|
||
expect(hole.hole_shape).toBe("square") | ||
expect(hole.hole_diameter).toBe(2.0) | ||
}) | ||
|
||
test("parse oval hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "oval", | ||
hole_width: 3.0, | ||
hole_height: 1.5, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("oval") | ||
expect(hole.hole_width).toBe(3.0) | ||
expect(hole.hole_height).toBe(1.5) | ||
}) | ||
|
||
test("parse pill hole", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 0, | ||
y: 0, | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
}) | ||
|
||
test("parse pill hole with optional properties", () => { | ||
const hole = pcb_hole.parse({ | ||
type: "pcb_hole", | ||
hole_shape: "pill", | ||
hole_width: 2.5, | ||
hole_height: 1.0, | ||
x: 1.5, | ||
y: -1.0, | ||
pcb_group_id: "group_1", | ||
subcircuit_id: "subcircuit_1", | ||
}) as PcbHoleOval | ||
|
||
expect(hole.hole_shape).toBe("pill") | ||
expect(hole.hole_width).toBe(2.5) | ||
expect(hole.hole_height).toBe(1.0) | ||
expect(hole.x).toBe(1.5) | ||
expect(hole.y).toBe(-1.0) | ||
expect(hole.pcb_group_id).toBe("group_1") | ||
expect(hole.subcircuit_id).toBe("subcircuit_1") | ||
}) |
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.
This test file contains 5 test functions, exceeding the limit of one test function per *.test.ts
file. Split this file into separate numbered files: pcb_hole1.test.ts
, pcb_hole2.test.ts
, pcb_hole3.test.ts
, pcb_hole4.test.ts
, and pcb_hole5.test.ts
, with each file containing exactly one test function.
Spotted by Diamond (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
Adding the
pill
shape similar like to thepcb_plated_hole