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

Function assertScenarioActions

packages/core/src/testing/assertions.ts:50–80  ·  view source on GitHub ↗
(
  actual: readonly RoutedAction[],
  expected: readonly RoutedAction[] | undefined,
)

Source from the content-addressed store, hash-verified

48}
49
50export function assertScenarioActions(
51 actual: readonly RoutedAction[],
52 expected: readonly RoutedAction[] | undefined,
53): readonly ScenarioMismatch[] {
54 if (expected === undefined) return Object.freeze([]);
55 const mismatches: ScenarioMismatch[] = [];
56 if (actual.length !== expected.length) {
57 mismatches.push({
58 code: "ZR_SCENARIO_ACTION_COUNT_MISMATCH",
59 path: "expectedActions",
60 detail: `Expected ${String(expected.length)} actions, observed ${String(actual.length)}`,
61 expected: expected.length,
62 actual: actual.length,
63 });
64 }
65 const max = Math.max(actual.length, expected.length);
66 for (let index = 0; index < max; index++) {
67 const want = expected[index];
68 const got = actual[index];
69 if (want === undefined || got === undefined) continue;
70 if (actionEquals(want, got)) continue;
71 mismatches.push({
72 code: "ZR_SCENARIO_ACTION_MISMATCH",
73 path: `expectedActions[${String(index)}]`,
74 detail: `Observed action does not match expected action at index ${String(index)}`,
75 expected: want,
76 actual: got,
77 });
78 }
79 return Object.freeze(mismatches);
80}
81
82export function assertScreenRegion(
83 screen: ScenarioScreenSnapshot,

Callers 1

evaluateScenarioResultFunction · 0.85

Calls 2

actionEqualsFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected