feat: add scoped history and artifacts
This commit is contained in:
@@ -48,3 +48,20 @@ it("bounds pending input and refuses admission after an explicit stop", async ()
|
||||
tracker.close();
|
||||
await expect(tracker.submit(input(21))).rejects.toMatchObject({ status: 409 });
|
||||
});
|
||||
|
||||
it("allows close after withdrawal and keeps cancelled retries from enqueueing again", async () => {
|
||||
const runtime = { listPendingUserInputs: async () => [], enqueueUserInput: mock(async () => {}) };
|
||||
const changed = mock((_input: ResponseInput) => {});
|
||||
const tracker = new ResponseInputTracker(runtime, "owned", changed);
|
||||
tracker.markReady();
|
||||
await tracker.submit(input(1));
|
||||
tracker.observe("session.inbox.cancelled", { inboxID: input(1).id });
|
||||
expect(changed.mock.calls.at(-1)?.[0].status).toBe("cancelled");
|
||||
expect(tracker.hasAdditionalInput).toBe(false);
|
||||
expect((await tracker.submit(input(1))).status).toBe("cancelled");
|
||||
expect(runtime.enqueueUserInput).toHaveBeenCalledTimes(1);
|
||||
tracker.observe("session.inbox.delivery.changed", { inboxID: input(1).id, delivery: "queue" });
|
||||
tracker.observe("session.inbox.delivered", { inboxID: input(1).id });
|
||||
expect(changed).toHaveBeenCalledTimes(2);
|
||||
expect(await tracker.canClose()).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user