Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
import { describe, expect, it, vi } from "vitest";
import { copyRoomCode } from "../src/client/components/room-code.ts";
describe("room code copy boundary", () => {
it("copies only the visible room code", async () => {
const writeText = vi.fn<(value: string) => Promise<void>>().mockResolvedValue();
await copyRoomCode("123456", writeText);
expect(writeText).toHaveBeenCalledOnce();
expect(writeText).toHaveBeenCalledWith("123456");
});
it("propagates clipboard failures for the UI to report", async () => {
const failure = new Error("clipboard unavailable");
const writeText = vi.fn<(value: string) => Promise<void>>().mockRejectedValue(failure);
await expect(copyRoomCode("7", writeText)).rejects.toBe(failure);
});
});