Public source validation / validate (push) Failing after 3m8s
25 lines
1.2 KiB
TypeScript
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();
|
|
});
|
|
});
|