Files
Netcatty/components/lazyLoadedSurfaces.test.ts
T
bincxz 7cba6bae2a feat(settings): add runtime Dock/taskbar icon variants (#1716)
Let users pick icon styles in Appearance settings with live Dock/window updates, dev public asset resolution, and cross-window sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 23:14:57 +08:00

35 lines
1.6 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
test("lazy load failures use a real page reload recovery", () => {
const source = readFileSync(new URL("./ui/lazy-load-boundary.tsx", import.meta.url), "utf8");
assert.match(source, /window\.location\.reload\(\)/);
assert.match(source, />\s*Reload\s*</);
});
test("SFTP text editor keeps a closable dialog while its chunk loads", () => {
const source = readFileSync(new URL("./sftp/SftpOverlays.tsx", import.meta.url), "utf8");
const loadingIndex = source.indexOf("const TextEditorModalLoading");
const suspenseFallbackIndex = source.indexOf("<TextEditorModalLoading", loadingIndex);
const unavailableIndex = source.indexOf("const TextEditorModalUnavailable");
const errorFallbackIndex = source.indexOf("<TextEditorModalUnavailable", unavailableIndex);
assert.notEqual(loadingIndex, -1);
assert.notEqual(suspenseFallbackIndex, -1);
assert.notEqual(unavailableIndex, -1);
assert.notEqual(errorFallbackIndex, -1);
});
test("settings lazy-load errors stay inside the active settings tab", () => {
const source = readFileSync(new URL("./SettingsPage.tsx", import.meta.url), "utf8");
const errorFallbackIndex = source.indexOf("const SettingsTabLoadError");
const tabContentIndex = source.indexOf("<SettingsTabContent value={value}>", errorFallbackIndex);
const boundaryFallbackIndex = source.indexOf("fallback={(error) => <SettingsTabLoadError value={value} error={error} />}");
assert.notEqual(errorFallbackIndex, -1);
assert.notEqual(tabContentIndex, -1);
assert.notEqual(boundaryFallbackIndex, -1);
});