MCPcopy Create free account
hub / github.com/effect-app/libs / assertPath

Function assertPath

repos/effect/packages/effect/test/Pathfinding.test.ts:75–95  ·  view source on GitHub ↗
(
  terrain: Terrain,
  actual: Option.Option<Graph.PathResult<number>>,
  sequence: Sequence
)

Source from the content-addressed store, hash-verified

73 * Assert that the result path matches the expected path.
74 */
75const assertPath = (
76 terrain: Terrain,
77 actual: Option.Option<Graph.PathResult<number>>,
78 sequence: Sequence
79) => {
80 const derived = sequenceFromPath(terrain, actual)
81 if (derived !== sequence) {
82 let message = "Path finding result did not match the expected sequence"
83 message += `\n`
84 message += `\nExpected: ${sequence}`
85 message += `\nActual: ${derived}`
86 message += `\n`
87 message += `\nExpected Path:`
88 message += `\n${printSolution(terrain, pathFromSequence(terrain, sequence))}`
89 message += `\n`
90 message += `\nActual Path:`
91 message += `\n${printSolution(terrain, Option.getOrUndefined(actual))}`
92
93 throw new AssertionError({ message, stackStartFn: assertPath })
94 }
95}
96
97type Sequence = `${number}:${number};${string}`
98

Callers 1

Calls 3

sequenceFromPathFunction · 0.85
printSolutionFunction · 0.85
pathFromSequenceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…