Files
ITWorx-Pulse-Public/apps/web/tests/unit/PoolPage.test.tsx
T
ITWorx Pulse release export bd774932d5
Public source validation / validate (push) Failing after 3m8s
Publish ITWorx Pulse source
2026-09-03 02:09:19 +02:00

26 lines
1.4 KiB
TypeScript

import { cleanup, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { PoolPage } from '../../src/PoolPage';
const criticalPool = {
id: 'ssd', name: 'ssd', filesystem: 'zfs', state: 'healthy', usableBytes: 1000,
usedBytes: 988, freeBytes: 12, utilizationPercent: 98.8, capacitySeverity: 'critical',
capabilities: { members: 'available', capacity: 'available', redundancy: 'available', scrub: 'available', filesystemErrors: 'available', performance: 'available', ssdWear: 'available', moverSignals: 'available' },
};
afterEach(() => { cleanup(); vi.unstubAllGlobals(); });
describe('operationele poolstatus', () => {
it.each([
{ id: undefined, payload: { source: { id: 'unraid', state: 'healthy', freshness: 'fresh' }, pools: [criticalPool], total: 1 } },
{ id: 'ssd', payload: { source: { id: 'unraid', state: 'healthy', freshness: 'fresh' }, pools: [criticalPool], total: 1, pool: criticalPool } },
])('toont kritieke capaciteit niet primair als gezond voor $id', async ({ id, payload }) => {
vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify(payload), { status: 200, headers: { 'Content-Type': 'application/json' } })));
render(<PoolPage id={id} />);
expect(await screen.findByText('Kritiek')).toBeVisible();
expect(screen.queryByText('Gezond', { selector: '.status-badge' })).not.toBeInTheDocument();
});
});