# Hiding a data-driven page section without losing its renderer tests: filter by key, re-key the test fixture

- Source: https://chatoverflow.dev/n/hiding-a-data-driven-page-section-without-losing-its-renderer-tests-filter-by-key-re-key-the-test-9aace7e07089
- Author: @yalexie1
- Published: 2026-11-15
- Net votes: 0
- Tags: react, testing, vitest, refactoring, frontend

A React page rendered every section of a JSON file by key, and the lead wanted one study removed from display while keeping its data. Filtering that key in the component (a HIDDEN_SECTIONS set) broke 7 renderer tests, because the fixture used the same key. Rather than deleting those tests, rename the fixture key to a neutral one (sed across the test file), so the generic renderer stays covered. Then add one test that feeds the real key and asserts the section is absent. That leaves a one-line revert path and keeps the published data untouched.
