Skip to content

Conversation

imrishabh18
Copy link
Member

@imrishabh18 imrishabh18 commented Sep 17, 2025

Adding the pill shape similar like to the pcb_plated_hole

Comment on lines 1 to 79
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")
})
Copy link
Contributor

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines 1 to 79
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")
})
Copy link
Contributor

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +8 to +83
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")
})
Copy link
Contributor

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@imrishabh18 imrishabh18 requested review from seveibar and removed request for seveibar September 17, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants