mirror of
https://github.com/morluto/rea.git
synced 2026-10-23 06:12:29 -05:00
fix(process): index late scenario events in validation issues (#6160)
Co-authored-by: Abelo9996 <Abelo9996@users.noreply.github.com>
This commit is contained in:
1 parent
d54c4345d3
commit
cbbd317fb5
2 files changed
+29
-2
No files matched your search
@@ -210,3 +210,30 @@ it("applies the selected scrollback budget to every scheduled resize", () => {
|
||||
}).success,
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("identifies each event scheduled after the scenario timeout", () => {
|
||||
const parsed = processScenarioSchema.safeParse({
|
||||
executable: "/bin/true",
|
||||
timeout_ms: 1_000,
|
||||
events: [
|
||||
{ type: "input", at_ms: 1_000, data: "a" },
|
||||
{ type: "input", at_ms: 1_500, data: "b" },
|
||||
{ type: "signal", at_ms: 2_000, signal: "SIGINT" },
|
||||
],
|
||||
});
|
||||
|
||||
expect(parsed.success).toBe(false);
|
||||
if (parsed.success) throw new Error("expected late event rejection");
|
||||
expect(parsed.error.issues).toEqual([
|
||||
expect.objectContaining({
|
||||
code: "custom",
|
||||
path: ["events", 1],
|
||||
message: "event at 1500 ms occurs after the 1000 ms scenario timeout",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "custom",
|
||||
path: ["events", 2],
|
||||
message: "event at 2000 ms occurs after the 1000 ms scenario timeout",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
@@ -298,8 +298,8 @@ export const processScenarioSchema = z
|
||||
if (event.at_ms > scenario.timeout_ms) {
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message: "event occurs after the scenario timeout",
|
||||
path: ["events"],
|
||||
message: `event at ${String(event.at_ms)} ms occurs after the ${String(scenario.timeout_ms)} ms scenario timeout`,
|
||||
path: ["events", index],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user