fix(school): show Nursery only for nursery classes, and say Girls' school
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m13s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 18s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m19s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 16s
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m13s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 18s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m19s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 16s
GIAS NurseryProvision is text ("Has Nursery Classes", "No Nursery
Classes", "Not applicable"), but the header and the place table tested it
for truthiness. Every school with a value got a Nursery chip or a "Yes",
including secondaries aged 11-18. hasNurseryClasses() matches the one
value that means a nursery, and the type now says the field is a string.
The single-sex chip appended 's to the plural GIAS gender, giving
"Girls's school". singleSexLabel() gives "Girls' school" / "Boys' school".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd5b48e612
commit
dea435a906
8 files changed
+158
-14
No files matched your search
@@ -15,6 +15,8 @@ import {
|
||||
computeYBounds,
|
||||
formatAgeRange,
|
||||
formatAgeSpan,
|
||||
hasNurseryClasses,
|
||||
singleSexLabel,
|
||||
} from '@/lib/utils';
|
||||
|
||||
describe('formatPercentage', () => {
|
||||
@@ -346,3 +348,27 @@ describe('formatAgeRange', () => {
|
||||
expect(formatAgeRange('4-11')).toBe('Ages 4–11');
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasNurseryClasses', () => {
|
||||
it('is true only for the GIAS value that means it', () => {
|
||||
// GIAS sends text, and two of its three values mean no nursery.
|
||||
expect(hasNurseryClasses('Has Nursery Classes')).toBe(true);
|
||||
expect(hasNurseryClasses('No Nursery Classes')).toBe(false);
|
||||
expect(hasNurseryClasses('Not applicable')).toBe(false);
|
||||
expect(hasNurseryClasses(null)).toBe(false);
|
||||
expect(hasNurseryClasses(undefined)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('singleSexLabel', () => {
|
||||
it('uses the plural possessive GIAS values need', () => {
|
||||
expect(singleSexLabel('Girls')).toBe("Girls' school");
|
||||
expect(singleSexLabel('Boys')).toBe("Boys' school");
|
||||
});
|
||||
|
||||
it('returns null for a mixed or unknown school', () => {
|
||||
expect(singleSexLabel('Mixed')).toBeNull();
|
||||
expect(singleSexLabel(null)).toBeNull();
|
||||
expect(singleSexLabel(undefined)).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user