MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / assertCursor

Function assertCursor

packages/core/src/testing/assertions.ts:114–151  ·  view source on GitHub ↗
(
  actual: ScenarioCursorSnapshot | null,
  expected: ScenarioCursorAssertion | undefined,
)

Source from the content-addressed store, hash-verified

112}
113
114export function assertCursor(
115 actual: ScenarioCursorSnapshot | null,
116 expected: ScenarioCursorAssertion | undefined,
117): ScenarioMismatch | null {
118 if (expected === undefined) return null;
119 if (actual === null) {
120 return {
121 code: "ZR_SCENARIO_CURSOR_MISMATCH",
122 path: "expectedCursorState",
123 detail: "Expected cursor snapshot but none was captured",
124 expected,
125 actual: null,
126 };
127 }
128 if (
129 actual.visible !== expected.visible ||
130 actual.shape !== expected.shape ||
131 actual.blink !== expected.blink
132 ) {
133 return {
134 code: "ZR_SCENARIO_CURSOR_MISMATCH",
135 path: "expectedCursorState",
136 detail: "Cursor visibility or styling did not match expected state",
137 expected,
138 actual,
139 };
140 }
141 if (expected.visible && actual.visible && (actual.x !== expected.x || actual.y !== expected.y)) {
142 return {
143 code: "ZR_SCENARIO_CURSOR_MISMATCH",
144 path: "expectedCursorState",
145 detail: "Cursor position did not match expected state",
146 expected,
147 actual,
148 };
149 }
150 return null;
151}
152
153function assertInvariant(
154 actual: readonly RoutedAction[],

Callers 1

evaluateScenarioResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected