diff options
| author | Adam Malczewski <[email protected]> | 2026-06-25 10:52:13 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-25 10:52:13 +0900 |
| commit | cd7f6cdfbd62bf4cf13c953bdb79d02158b6019e (patch) | |
| tree | 765a10ae2d558083310f91854ee459835315294f /src/adapters/ws/logic.test.ts | |
| parent | baedda844cbf51f2106833084807a2775d64caa3 (diff) | |
| download | dispatch-web-cd7f6cdfbd62bf4cf13c953bdb79d02158b6019e.tar.gz dispatch-web-cd7f6cdfbd62bf4cf13c953bdb79d02158b6019e.zip | |
feat(core): chunks retry-banner, wire conformance, ws logic, history adapter
- core/chunks: add retry-banner view-model (+test), update reducer/selectors/types
- core/wire: update conformance checks (+test)
- adapters/ws: update reconnect logic (+tests)
- adapters/history: new client-side routing adapter (history + popstate wrapper)
Diffstat (limited to 'src/adapters/ws/logic.test.ts')
| -rw-r--r-- | src/adapters/ws/logic.test.ts | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/src/adapters/ws/logic.test.ts b/src/adapters/ws/logic.test.ts index 2463519..062d47b 100644 --- a/src/adapters/ws/logic.test.ts +++ b/src/adapters/ws/logic.test.ts @@ -219,18 +219,52 @@ describe("parseServerMessage", () => { }); it("parses a conversation.open message", () => { - const data = JSON.stringify({ type: "conversation.open", conversationId: "c1" }); + const data = JSON.stringify({ + type: "conversation.open", + conversationId: "c1", + workspaceId: "w1", + }); const result = parseServerMessage(data); - expect(result).toEqual({ type: "conversation.open", conversationId: "c1" }); + expect(result).toEqual({ + type: "conversation.open", + conversationId: "c1", + workspaceId: "w1", + }); }); it("returns null for conversation.open with missing conversationId", () => { - expect(parseServerMessage(JSON.stringify({ type: "conversation.open" }))).toBeNull(); + expect( + parseServerMessage(JSON.stringify({ type: "conversation.open", workspaceId: "w1" })), + ).toBeNull(); }); it("returns null for conversation.open with non-string conversationId", () => { expect( - parseServerMessage(JSON.stringify({ type: "conversation.open", conversationId: 42 })), + parseServerMessage( + JSON.stringify({ + type: "conversation.open", + conversationId: 42, + workspaceId: "w1", + }), + ), + ).toBeNull(); + }); + + it("returns null for conversation.open with missing workspaceId", () => { + expect( + parseServerMessage(JSON.stringify({ type: "conversation.open", conversationId: "c1" })), + ).toBeNull(); + }); + + it("returns null for conversation.open with non-string workspaceId", () => { + expect( + parseServerMessage( + JSON.stringify({ + type: "conversation.open", + conversationId: "c1", + workspaceId: 42, + }), + ), ).toBeNull(); }); @@ -239,14 +273,40 @@ describe("parseServerMessage", () => { type: "conversation.statusChanged", conversationId: "c1", status: "active", + workspaceId: "w1", }); expect(parseServerMessage(data)).toEqual({ type: "conversation.statusChanged", conversationId: "c1", status: "active", + workspaceId: "w1", }); }); + it("returns null for conversation.statusChanged with missing workspaceId", () => { + expect( + parseServerMessage( + JSON.stringify({ + type: "conversation.statusChanged", + conversationId: "c1", + status: "active", + }), + ), + ).toBeNull(); + }); + + it("returns null for conversation.statusChanged with non-string workspaceId", () => { + expect( + parseServerMessage( + JSON.stringify({ + type: "conversation.statusChanged", + conversationId: "c1", + status: "active", + workspaceId: 42, + }), + ), + ).toBeNull(); + }); it("returns null for conversation.statusChanged with invalid status", () => { expect( parseServerMessage( @@ -254,6 +314,7 @@ describe("parseServerMessage", () => { type: "conversation.statusChanged", conversationId: "c1", status: "done", + workspaceId: "w1", }), ), ).toBeNull(); |
