Files
piik/tests/room-restore-presentation.test.ts
T
AAA 1715a191a1 refactor(client): remove exports only their tests called
The orchestration that used these helpers was retired in 5d4a67cf and
5126b9a0, leaving them reachable only from their own tests. The Browser-
rejected video check and its error, the encoded-frame maximum, the quality
label and whole-settings comparison (with the audio comparison it alone
used), and the unused PeerSnapshot, ChannelRequest and NativePageMpdTrack
types go. The video-only comparison, which the encoding pool and transport
still use, stays.

currentLang had no product caller; the tests that read the language through
it now read it through say(), the accessor the product uses.
2026-11-25 18:30:26 +08:00

21 lines
1.2 KiB
TypeScript

import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { expect, test } from "vitest";
import { RoomRestoreResult } from "../src/client/channel/components/BackupControls";
import { ChannelSettingsError } from "../src/client/channel/components/ChannelSettingsDialog";
import { say } from "../src/client/ui/copy";
test("an unconfirmed room restore offers closing and checking the room list", () => {
const html = renderToStaticMarkup(createElement(RoomRestoreResult, { message: say("channel.error.roomRestoreUnconfirmed"), unconfirmed: true, onClose() {} }));
expect(html).toContain(say("channel.error.roomRestoreUnconfirmed"));
expect(html).toContain(say("room.action.close"));
expect(html.match(/<button\b/g)).toHaveLength(1);
expect(html).not.toContain(say("room.create.reconnect"));
});
test("a confirmed commit followed by a failed reconnect reports that room data was restored", () => {
const html = renderToStaticMarkup(createElement(ChannelSettingsError, { error: "room_restored_connection_failed" }));
expect(html).toContain(say("channel.error.roomRestoredConnectionFailed"));
expect(html).not.toContain(say("channel.error.roomRestoreUnconfirmed"));
});