fix(web): require post-acceptance state
This commit is contained in:
@@ -429,7 +429,7 @@ describe("structured connection: reconnection/error/loading", () => {
|
||||
conn.dispose();
|
||||
});
|
||||
|
||||
it("releases an accepted submission from an idle snapshot after reconnect", async () => {
|
||||
it("releases an accepted submission from a post-acceptance idle snapshot", async () => {
|
||||
vi.mocked(sendStructuredPrompt).mockResolvedValueOnce(undefined);
|
||||
const first = new FakeSocket();
|
||||
const second = new FakeSocket();
|
||||
@@ -452,14 +452,15 @@ describe("structured connection: reconnection/error/loading", () => {
|
||||
conn.dispose();
|
||||
});
|
||||
|
||||
it("releases when reconnect idle arrives before submission acceptance", async () => {
|
||||
it("does not release from reconnect idle cached before submission acceptance", async () => {
|
||||
let accept!: () => void;
|
||||
vi.mocked(sendStructuredPrompt).mockImplementationOnce(
|
||||
() => new Promise((resolve) => { accept = resolve; }),
|
||||
);
|
||||
const first = new FakeSocket();
|
||||
const second = new FakeSocket();
|
||||
const conn = mount({ sockets: [first, second], shouldReconnect: () => true });
|
||||
const third = new FakeSocket();
|
||||
const conn = mount({ sockets: [first, second, third], shouldReconnect: () => true });
|
||||
first.open();
|
||||
first.emit({ type: "transcript_snapshot", snapshot: { cursor: 0, rows: [] } });
|
||||
first.emit({ type: "reduced_state", state: idleState });
|
||||
@@ -477,6 +478,12 @@ describe("structured connection: reconnection/error/loading", () => {
|
||||
accept();
|
||||
await Promise.resolve().then(() => Promise.resolve());
|
||||
|
||||
expect(input.disabled).toBe(true);
|
||||
expect(second.closed).toBe(true);
|
||||
|
||||
third.open();
|
||||
third.emit({ type: "transcript_snapshot", snapshot: { cursor: 0, rows: [] } });
|
||||
third.emit({ type: "reduced_state", state: idleState });
|
||||
expect(input.disabled).toBe(false);
|
||||
conn.dispose();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user