test: add jsdom globals and school detail fixtures
jsdom provides neither IntersectionObserver nor scrollTo; both detail views use them. Adds four fixtures (primary, secondary, all-through, special) covering the branches the characterization tests will pin. SchoolResult carries 57 required nullable fields, so fixtures are built from an all-null base row and override only what they exercise. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,23 @@ Object.defineProperty(window, 'matchMedia', {
|
||||
})),
|
||||
});
|
||||
|
||||
// jsdom implements neither of these; the school detail views use both
|
||||
// (IntersectionObserver for the scroll-spy and the hero-CTA tracker,
|
||||
// scrollTo for the "back to top" control).
|
||||
global.IntersectionObserver = class {
|
||||
constructor(callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
takeRecords() {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
window.scrollTo = jest.fn();
|
||||
|
||||
// Mock localStorage
|
||||
const localStorageMock = {
|
||||
getItem: jest.fn(),
|
||||
|
||||
Reference in New Issue
Block a user