mirror of
https://github.com/unraid/api.git
synced 2025-12-31 05:29:48 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Introduced Docker management UI components: Overview, Logs, Console, Preview, and Edit. - Added responsive Card/Detail layouts with grouping, bulk actions, and tabs. - New UnraidToaster component and global toaster configuration. - Component auto-mounting improved with async loading and multi-selector support. - UI/UX - Overhauled theme system (light/dark tokens, primary/orange accents) and added theme variants. - Header OS version now includes integrated changelog modal. - Registration displays warning states; multiple visual polish updates. - API - CPU load now includes percentGuest and percentSteal metrics. - Chores - Migrated web app to Vite; updated artifacts and manifests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Michael Datelle <mdatelle@icloud.com>
32 lines
879 B
TypeScript
32 lines
879 B
TypeScript
import { createPinia, setActivePinia } from 'pinia';
|
|
|
|
import { beforeEach, vi } from 'vitest';
|
|
|
|
// Mock WebSocket for test environment
|
|
if (!global.WebSocket) {
|
|
const mockWebSocket = vi.fn().mockImplementation(() => ({
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
close: vi.fn(),
|
|
send: vi.fn(),
|
|
readyState: 1,
|
|
CONNECTING: 0,
|
|
OPEN: 1,
|
|
CLOSING: 2,
|
|
CLOSED: 3,
|
|
}));
|
|
|
|
// Add static properties to match WebSocket interface
|
|
Object.defineProperty(mockWebSocket, 'CONNECTING', { value: 0 });
|
|
Object.defineProperty(mockWebSocket, 'OPEN', { value: 1 });
|
|
Object.defineProperty(mockWebSocket, 'CLOSING', { value: 2 });
|
|
Object.defineProperty(mockWebSocket, 'CLOSED', { value: 3 });
|
|
|
|
global.WebSocket = mockWebSocket as unknown as typeof WebSocket;
|
|
}
|
|
|
|
beforeEach(() => {
|
|
const pinia = createPinia();
|
|
setActivePinia(pinia);
|
|
});
|