refactor: migrate legacy wire namespace to wrn
Quality / quality (ubuntu-latest) (push) Failing after 9m49s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 18:51:15 +05:30
parent ec23dd4c93
commit 2c960fc1dc
488 changed files with 27306 additions and 19063 deletions
+5 -5
View File
@@ -103,9 +103,9 @@ test("submitting [data-room-send] sends JSON and clears reset fields", () => {
expect((inputs[1] as unknown as HTMLInputElement).value).toBe("");
});
test("programmatic wire.room() sends and receives", () => {
test("programmatic wrn.room() sends and receives", () => {
const win = boot(`<div></div>`) as unknown as Window & {
wire: {
wrn: {
room: (n: string) => {
on: (t: string, cb: (m: unknown) => void) => unknown;
send: (o: unknown) => void;
@@ -113,7 +113,7 @@ test("programmatic wire.room() sends and receives", () => {
};
};
const got: unknown[] = [];
const room = win.wire.room("lobby");
const room = win.wrn.room("lobby");
room.on("ping", (m: unknown) => got.push(m));
sockets[0]!.fireOpen();
room.send({ type: "hello" });
@@ -137,11 +137,11 @@ 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 };
wrn: { 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);
win.wrn.bindRooms(win.document);
expect(sockets[0]?.readyState).toBe(3);
expect(sockets[1]?.url).toBe("ws://localhost/realtime/teamspace?user=neha");
});