refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user