fix: resolve type errors and test failures from branch integration

- Align portless code with storage branch's numeric workspace IDs and new field names
- Update workspace kind comparisons (local_checkout → checkout/worktree)
- Add missing services, supportsTerminalMode, terminal fields to test fixtures
- Fix archive timestamp assertions to match dynamic archiveSnapshot flow
- Fix dictation, voice runtime, and service health monitor test timing
- Add xterm-addon-ligatures type declaration for terminal emulator
This commit is contained in:
Mohamed Boudra
2026-04-01 22:58:59 +07:00
parent d75dd33773
commit 59cb4d7499
29 changed files with 405 additions and 235 deletions
@@ -5,16 +5,33 @@ type MockPlatform = "web" | "ios" | "android";
type GlobalSnapshot = {
Notification: unknown;
navigatorDescriptor?: PropertyDescriptor;
windowDescriptor?: PropertyDescriptor;
paseoDesktop: unknown;
};
const originalGlobals: GlobalSnapshot = {
Notification: (globalThis as { Notification?: unknown }).Notification,
navigatorDescriptor: Object.getOwnPropertyDescriptor(globalThis, "navigator"),
windowDescriptor: Object.getOwnPropertyDescriptor(globalThis, "window"),
paseoDesktop:
typeof window === "undefined" ? undefined : (window as { paseoDesktop?: unknown }).paseoDesktop,
};
function ensureWindow(): { paseoDesktop?: unknown } {
const existingWindow = (globalThis as { window?: { paseoDesktop?: unknown } }).window;
if (existingWindow) {
return existingWindow;
}
const nextWindow: { paseoDesktop?: unknown } = {};
Object.defineProperty(globalThis, "window", {
configurable: true,
writable: true,
value: nextWindow,
});
return nextWindow;
}
function setNavigator(value: unknown): void {
Object.defineProperty(globalThis, "navigator", {
configurable: true,
@@ -32,6 +49,12 @@ function restoreGlobals(): void {
delete (globalThis as { navigator?: unknown }).navigator;
}
if (originalGlobals.windowDescriptor) {
Object.defineProperty(globalThis, "window", originalGlobals.windowDescriptor);
} else {
delete (globalThis as { window?: unknown }).window;
}
if (typeof window !== "undefined") {
(window as { paseoDesktop?: unknown }).paseoDesktop = originalGlobals.paseoDesktop;
}
@@ -56,7 +79,7 @@ describe("desktop-permissions", () => {
expect(shouldShowDesktopPermissionSection()).toBe(false);
(window as { paseoDesktop?: unknown }).paseoDesktop = {};
ensureWindow().paseoDesktop = {};
expect(shouldShowDesktopPermissionSection()).toBe(true);
});