fix(test): snapshot postHookActions array in test helper to match production drain
The test drainPostHookActions helper iterated the live array, but triggerInternalHook snapshots with [...(event.postHookActions ?? [])] before draining. Align test helper to match production semantics.
This commit is contained in:
parent
a0073bfb9b
commit
c032cfbec5
@ -578,7 +578,11 @@ describe("session-memory hook", () => {
|
||||
async function drainPostHookActions(event: {
|
||||
postHookActions: Array<() => Promise<void> | void>;
|
||||
}) {
|
||||
for (const action of event.postHookActions) {
|
||||
// Snapshot before draining — matches triggerInternalHook's production
|
||||
// semantics (prevents self-scheduling actions from executing in the
|
||||
// same drain cycle).
|
||||
const pending = [...event.postHookActions];
|
||||
for (const action of pending) {
|
||||
try {
|
||||
await action();
|
||||
} catch {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user