36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
/**
|
|||
|
|
* SchoolRow (primary search results): line 2 prints the religious character
|
||
|
|
* only when the school has one. The register's "None" was printed as a chip.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import '@testing-library/jest-dom';
|
||
|
|
import { render, screen } from '@testing-library/react';
|
||
|
|
import { SchoolRow } from '@/components/SchoolRow';
|
||
|
|
import type { School } from '@/lib/types';
|
||
|
|
|
||
|
|
const base = {
|
||
|
|
urn: 100001,
|
||
|
|
school_name: 'Alpha Primary School',
|
||
|
|
local_authority: 'Testshire',
|
||
|
|
school_type: 'Free schools',
|
||
|
|
phase: 'Primary',
|
||
|
|
gender: 'Mixed',
|
||
|
|
age_range: '4-11',
|
||
|
|
rwm_expected_pct: 70,
|
||
|
|
} as unknown as School;
|
||
|
|
|
||
|
|
describe('SchoolRow religious character', () => {
|
||
|
|
it.each(['None', 'Does not apply', ''])(
|
||
|
|
'prints nothing when the register says %p',
|
||
|
|
(religious_denomination) => {
|
||
|
|
render(<SchoolRow school={{ ...base, religious_denomination }} />);
|
||
|
|
expect(screen.queryByText('None')).not.toBeInTheDocument();
|
||
|
|
expect(screen.queryByText('Does not apply')).not.toBeInTheDocument();
|
||
|
|
},
|
||
|
|
);
|
||
|
|
|
||
|
|
it('prints a religious character the school has', () => {
|
||
|
|
render(<SchoolRow school={{ ...base, religious_denomination: 'Church of England' }} />);
|
||
|
|
expect(screen.getByText('Church of England')).toBeInTheDocument();
|
||
|
|
});
|
||
|
|
});
|