47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
/**
|
|
* SecondarySchoolRow — sixth-form tag must come from the GIAS
|
|
* has_sixth_form flag, not the age_range-contains-"18" heuristic.
|
|
*/
|
|
|
|
import '@testing-library/jest-dom';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { SecondarySchoolRow } from '@/components/SecondarySchoolRow';
|
|
import type { School } from '@/lib/types';
|
|
|
|
const base = {
|
|
urn: 100002,
|
|
school_name: 'Beta Sixth Form College',
|
|
local_authority: 'Testshire',
|
|
school_type: 'Academy',
|
|
phase: 'Secondary',
|
|
gender: 'Mixed',
|
|
attainment_8_score: 50.0,
|
|
} as unknown as School;
|
|
|
|
describe('SecondarySchoolRow sixth-form tag', () => {
|
|
it('shows the tag for a 16-19 college with the GIAS flag set', () => {
|
|
render(
|
|
<SecondarySchoolRow
|
|
school={{ ...base, age_range: '16-19', has_sixth_form: true }}
|
|
/>,
|
|
);
|
|
expect(screen.getByText('Sixth form')).toBeInTheDocument();
|
|
});
|
|
|
|
it('hides the tag for an 11-18 school without a registered sixth form', () => {
|
|
render(
|
|
<SecondarySchoolRow
|
|
school={{ ...base, age_range: '11-18', has_sixth_form: false }}
|
|
/>,
|
|
);
|
|
expect(screen.queryByText('Sixth form')).not.toBeInTheDocument();
|
|
});
|
|
|
|
it('hides the tag when the flag is missing (pipeline not yet re-run)', () => {
|
|
render(
|
|
<SecondarySchoolRow school={{ ...base, age_range: '11-18' }} />,
|
|
);
|
|
expect(screen.queryByText('Sixth form')).not.toBeInTheDocument();
|
|
});
|
|
});
|