Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/schematic/schematic_voltage_probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface SchematicVoltageProbe {
type: "schematic_voltage_probe"
schematic_voltage_probe_id: string
source_component_id?: string
name?: string
position: Point
schematic_trace_id: string
voltage?: number
Expand All @@ -19,6 +20,7 @@ export const schematic_voltage_probe = z
type: z.literal("schematic_voltage_probe"),
schematic_voltage_probe_id: z.string(),
source_component_id: z.string().optional(),
name: z.string().optional(),
position: point,
schematic_trace_id: z.string(),
voltage: voltage.optional(),
Expand Down
2 changes: 2 additions & 0 deletions src/simulation/simulation_voltage_probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const simulation_voltage_probe = z
"simulation_voltage_probe",
),
source_component_id: z.string().optional(),
name: z.string().optional(),
source_port_id: z.string().optional(),
source_net_id: z.string().optional(),
subcircuit_id: z.string().optional(),
Expand Down Expand Up @@ -37,6 +38,7 @@ export interface SimulationVoltageProbe {
type: "simulation_voltage_probe"
simulation_voltage_probe_id: string
source_component_id?: string
name?: string
source_port_id?: string
source_net_id?: string
subcircuit_id?: string
Expand Down
14 changes: 14 additions & 0 deletions tests/simulation_voltage_probe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ test("simulation_voltage_probe with no connection ids should throw", () => {
expect(() => simulation_voltage_probe.parse(input)).toThrow()
})

test("simulation_voltage_probe parses with name", () => {
const input: SimulationVoltageProbeInput = {
type: "simulation_voltage_probe",
source_net_id: "net1",
name: "My Probe",
}

const result = simulation_voltage_probe.parse(input)
const probe = result as SimulationVoltageProbe

expect(probe.source_net_id).toBe("net1")
expect(probe.name).toBe("My Probe")
})
Comment on lines +48 to +60
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 violates the rule that a *.test.ts file may have AT MOST one test(...) function. The file now contains 2 test functions after adding the new test on line 48. The file should be split into multiple numbered files, such as simulation_voltage_probe1.test.ts and simulation_voltage_probe2.test.ts, with each file containing only one test function.

Spotted by Graphite Agent (based on custom rule: Custom rule)

Fix in Graphite


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


test("simulation_voltage_probe with both connection ids should throw", () => {
const input: SimulationVoltageProbeInput = {
type: "simulation_voltage_probe",
Expand Down
2 changes: 2 additions & 0 deletions tests/source_simple_voltage_probe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ test("source_simple_voltage_probe links to schematic and simulation", () => {
expect(schematicProbe.source_component_id).toBe(
sourceVoltageProbe.source_component_id,
)
expect(schematicProbe.name).toBe("VP1")
expect(simulationProbe.source_component_id).toBe(
sourceVoltageProbe.source_component_id,
)
expect(simulationProbe.name).toBe("VP1")
})