20 lines
1.2 KiB
TypeScript
20 lines
1.2 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|||
|
|
import { InspectionNotice } from '@/components/school/InspectionNotice';
|
||
|
|
|
||
|
|
it('names ISI and links its reports for an ISI school (audit H4)', () => {
|
||
|
|
render(<InspectionNotice school={{ urn: 136083, inspectorate: 'ISI', ofsted_listed: false }} />);
|
||
|
|
expect(screen.getByText('Inspected by the Independent Schools Inspectorate (ISI)')).toBeInTheDocument();
|
||
|
|
expect(screen.getByRole('link', { name: /ISI reports/ })).toHaveAttribute('href', 'https://www.isi.net/reports/');
|
||
|
|
});
|
||
|
|
|
||
|
|
it('says "Not yet inspected" for a school Ofsted lists without an inspection', () => {
|
||
|
|
render(<InspectionNotice school={{ urn: 150031, inspectorate: 'Not applicable', ofsted_listed: true }} />);
|
||
|
|
expect(screen.getByText('Not yet inspected')).toBeInTheDocument();
|
||
|
|
expect(screen.getByRole('link', { name: /Ofsted reports/ })).toHaveAttribute(
|
||
|
|
'href', 'https://reports.ofsted.gov.uk/inspection-reports/find-inspection-report/provider/ELS/150031');
|
||
|
|
});
|
||
|
|
|
||
|
|
it('renders nothing without inspection data, including an unknown listing', () => {
|
||
|
|
const { container } = render(<InspectionNotice school={{ urn: 1, inspectorate: null, ofsted_listed: null }} />);
|
||
|
|
expect(container).toBeEmptyDOMElement();
|
||
|
|
});
|