test(gateway): update exec-approval test for two-phase response
Add assertion for immediate 'accepted' response before final decision.
This commit is contained in:
parent
b1d409738b
commit
0ccb5584ee
@ -82,6 +82,13 @@ describe("exec approval handlers", () => {
|
|||||||
const id = (requested?.payload as { id?: string })?.id ?? "";
|
const id = (requested?.payload as { id?: string })?.id ?? "";
|
||||||
expect(id).not.toBe("");
|
expect(id).not.toBe("");
|
||||||
|
|
||||||
|
// First response should be "accepted" (registration confirmation)
|
||||||
|
expect(respond).toHaveBeenCalledWith(
|
||||||
|
true,
|
||||||
|
expect.objectContaining({ status: "accepted", id }),
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
|
||||||
const resolveRespond = vi.fn();
|
const resolveRespond = vi.fn();
|
||||||
await handlers["exec.approval.resolve"]({
|
await handlers["exec.approval.resolve"]({
|
||||||
params: { id, decision: "allow-once" },
|
params: { id, decision: "allow-once" },
|
||||||
@ -97,6 +104,7 @@ describe("exec approval handlers", () => {
|
|||||||
await requestPromise;
|
await requestPromise;
|
||||||
|
|
||||||
expect(resolveRespond).toHaveBeenCalledWith(true, { ok: true }, undefined);
|
expect(resolveRespond).toHaveBeenCalledWith(true, { ok: true }, undefined);
|
||||||
|
// Second response should contain the decision
|
||||||
expect(respond).toHaveBeenCalledWith(
|
expect(respond).toHaveBeenCalledWith(
|
||||||
true,
|
true,
|
||||||
expect.objectContaining({ id, decision: "allow-once" }),
|
expect.objectContaining({ id, decision: "allow-once" }),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user