Files
ITWorx-Pulse-Public/apps/web/tests/unit/SourceStatusDetails.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

25 lines
1.2 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { SourceStatusDetails } from '../../src/SourceStatusDetails';
describe('SourceStatusDetails', () => {
it('scheidt bronstatus van databruikbaarheid en houdt de code ingeklapt', () => {
render(<SourceStatusDetails source={{ id: 'unraid', state: 'healthy', freshness: 'stale', observedAt: '2026-08-21T13:00:00Z', reason: 'source_stale' }} />);
expect(screen.getByText(/Bronstatus:/).closest('span')).toHaveTextContent('Gezond');
expect(screen.getByText(/Data:/).closest('span')).toHaveTextContent('Verouderd');
expect(screen.getByText(/laatste meting is verouderd/i)).toBeVisible();
const code = screen.getByText('source_stale');
expect(code.closest('details')).not.toHaveAttribute('open');
expect(code).not.toBeVisible();
});
it('toont nooit ontvangen zonder een misleidend time-element', () => {
const { container } = render(<SourceStatusDetails source={{ id: 'host', state: 'unknown', freshness: 'unavailable', observedAt: '0001-01-01T00:00:00Z' }} />);
expect(screen.getByText('Nooit ontvangen')).toBeVisible();
expect(container.querySelector('time')).toBeNull();
});
});