Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { SetupCompletionPreview } from '../SetupCompletionPreview';
const navigateMock = vi.fn();
const apiFetchJSONMock = vi.fn();
let locationSearch = '';
vi.mock('@solidjs/router', async () => {
const actual = await vi.importActual<typeof import('@solidjs/router')>('@solidjs/router');
return {
...actual,
useLocation: () => ({ search: locationSearch }),
useNavigate: () => navigateMock,
};
});
vi.mock('@/utils/apiClient', () => ({
apiFetchJSON: (...args: unknown[]) => apiFetchJSONMock(...args),
}));
vi.mock('@/stores/license', () => ({
loadRuntimeCapabilities: vi.fn(),
entitlements: () => ({ relay: false }),
getUpgradeActionUrlOrFallback: () => 'https://pulse.example.com/upgrade',
startProTrial: vi.fn(),
}));
vi.mock('@/utils/toast', () => ({
showSuccess: vi.fn(),
showError: vi.fn(),
}));
vi.mock('@/utils/logger', () => ({
logger: {
error: vi.fn(),
warn: vi.fn(),
info: vi.fn(),
debug: vi.fn(),
},
}));
describe('SetupCompletionPreview', () => {
beforeEach(() => {
navigateMock.mockReset();
locationSearch = '';
apiFetchJSONMock.mockResolvedValue({ resources: [] });
});
afterEach(() => {
cleanup();
});
it('keeps setup completion preview outside the runtime wizard flow', () => {
render(() => <SetupCompletionPreview />);
expect(apiFetchJSONMock).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole('button', { name: 'Add infrastructure' }));
expect(navigateMock).toHaveBeenCalledWith('/settings/infrastructure?add=pick');
});
it('renders the VMware-connected preview scenario without polling runtime state', () => {
locationSearch = '?scenario=vmware-api-backed';
render(() => <SetupCompletionPreview />);
expect(apiFetchJSONMock).not.toHaveBeenCalled();
expect(screen.getByText('First monitored system connected')).toBeInTheDocument();
expect(screen.getByText('VMware vSphere')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Add infrastructure' })).toBeInTheDocument();
});
it('renders the pro-unlicensed scenario with the activation pointer and no license probe', () => {
locationSearch = '?scenario=pro-unlicensed';
render(() => <SetupCompletionPreview />);
expect(apiFetchJSONMock).not.toHaveBeenCalled();
expect(screen.getByText('Activate Pulse Pro')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Enter activation key' }));
expect(navigateMock).toHaveBeenCalledWith('/settings/pulse-intelligence/billing/plan');
});
it('keeps the activation pointer out of the default preview scenario', () => {
render(() => <SetupCompletionPreview />);
expect(apiFetchJSONMock).not.toHaveBeenCalled();
expect(screen.queryByText('Activate Pulse Pro')).not.toBeInTheDocument();
});
});