@tscircuit/rectdiff 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,34 +1,28 @@
1
1
  import { expect, test } from "bun:test"
2
- import middleGapFixture from "test-assets/gap-fill-h-shape-should-expand-node.json"
3
- import { getSvgFromGraphicsObject } from "graphics-debug"
4
- import { GapFillSolverPipeline } from "lib/solvers/GapFillSolver/GapFillSolverPipeline"
5
- import type { CapacityMeshNode } from "lib/types/capacity-mesh-types"
2
+ import { getSvgFromGraphicsObject, mergeGraphics } from "graphics-debug"
3
+ import { RectDiffExpansionSolver } from "lib/solvers/RectDiffExpansionSolver/RectDiffExpansionSolver"
4
+ import { createTwoNodeExpansionInput } from "lib/fixtures/twoNodeExpansionFixture"
6
5
  import { makeCapacityMeshNodeWithLayerInfo } from "./fixtures/makeCapacityMeshNodeWithLayerInfo"
6
+ import { makeSimpleRouteOutlineGraphics } from "./fixtures/makeSimpleRouteOutlineGraphics"
7
7
 
8
- test("should expand capacityMeshNode to fill the gap", async () => {
9
- const solver = new GapFillSolverPipeline({
10
- meshNodes: middleGapFixture.meshNodes as CapacityMeshNode[],
11
- })
8
+ test("RectDiff expansion reproduces the two-node gap fixture", async () => {
9
+ const input = createTwoNodeExpansionInput()
10
+ const solver = new RectDiffExpansionSolver(input)
12
11
 
13
12
  solver.solve()
14
13
 
15
- const { outputNodes } = solver.getOutput()
14
+ const { meshNodes } = solver.getOutput()
15
+ expect(meshNodes.length).toBeGreaterThanOrEqual(2)
16
16
 
17
- expect(outputNodes.length).toBeGreaterThanOrEqual(
18
- middleGapFixture.meshNodes.length,
19
- )
20
-
21
- const finalGraphics = makeCapacityMeshNodeWithLayerInfo(outputNodes)
17
+ const finalGraphics = makeCapacityMeshNodeWithLayerInfo(meshNodes)
18
+ const outline = makeSimpleRouteOutlineGraphics(input.srj)
22
19
  const svg = getSvgFromGraphicsObject(
23
- { rects: finalGraphics.values().toArray().flat() },
20
+ mergeGraphics({ rects: finalGraphics.values().toArray().flat() }, outline),
24
21
  {
25
22
  svgWidth: 640,
26
23
  svgHeight: 480,
27
24
  },
28
25
  )
29
26
 
30
- // More means we have added new nodes to fill the gap
31
- // expect(outputNodes.length).toEqual(3)
32
-
33
27
  await expect(svg).toMatchSvgSnapshot(import.meta.path)
34
28
  })