This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { ArrayPage } from '../../src/ArrayPage';
|
||||
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
describe('ArrayPage', () => {
|
||||
it('renders a bounded empty state when an older snapshot contains null collections', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({
|
||||
contractVersion: '1',
|
||||
source: { id: 'array', state: 'unknown', freshness: 'unavailable' },
|
||||
state: 'unknown',
|
||||
parity: { present: false, state: 'unknown', errors: 0 },
|
||||
members: null,
|
||||
history: null,
|
||||
}), { status: 200, headers: { 'Content-Type': 'application/json' } })));
|
||||
|
||||
render(<ArrayPage />);
|
||||
|
||||
expect(await screen.findByRole('heading', { level: 1, name: 'Array en parity' })).toBeVisible();
|
||||
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user