release: WRNexusJS 0.8.3
Quality / quality (ubuntu-latest) (push) Failing after 12m9s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-03 19:47:30 +05:30
parent e8f630f12d
commit 4cebacadfe
156 changed files with 2608 additions and 473 deletions
+24
View File
@@ -121,3 +121,27 @@ test("programmatic wire.room() sends and receives", () => {
sockets[0]!.fireMessage({ type: "ping", n: 1 });
expect(got).toEqual([{ type: "ping", n: 1 }]);
});
test("same room with different users opens identity-specific sockets", () => {
boot(`
<div data-room="teamspace" data-room-user="asha"></div>
<div data-room="teamspace" data-room-user="rohan"></div>
`);
expect(sockets.map((socket) => socket.url).sort()).toEqual([
"ws://localhost/realtime/teamspace?user=asha",
"ws://localhost/realtime/teamspace?user=rohan",
]);
});
test("declarative room reconnects when its user identity changes", () => {
const win = boot(
`<div id="room" data-room="teamspace" data-room-user="asha"></div>`,
) as unknown as Window & {
wire: { bindRooms: (root?: unknown) => void };
};
expect(sockets[0]?.url).toBe("ws://localhost/realtime/teamspace?user=asha");
win.document.getElementById("room")!.setAttribute("data-room-user", "neha");
win.wire.bindRooms(win.document);
expect(sockets[0]?.readyState).toBe(3);
expect(sockets[1]?.url).toBe("ws://localhost/realtime/teamspace?user=neha");
});