test(table): remove conditionals from TableChart tests #36149
test(table): remove conditionals from TableChart tests #36149sadpandajoe merged 4 commits intomasterfrom
Conversation
Code Review Agent Run #1089e0Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors TableChart tests to eliminate conditional logic, following the testing best practice "tests should not contain conditionals." The original tests used if (labelledBy) conditionals which could cause assertion skipping, potentially masking issues.
Key changes:
- Split 2 tests containing conditionals into 4 unconditional tests with explicit assertions
- Enhanced ARIA accessibility validation to ensure ALL cells have proper
aria-labelledbyattributes - Added explicit checks to catch empty tables and unlabeled cells
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
…IA validation Remove conditional logic from table tests following the principle that tests should not contain conditionals. Split 2 tests with if statements into 4 unconditional tests with explicit assertions. Changes: - Remove if(labelledBy) guards from ARIA validation tests - Split "header IDs" tests to separate ARIA validation into new tests - Add complete coverage check: all tbody td cells must have aria-labelledby - Add empty table guard to catch regressions (prevents silent 0===0 pass) - Replace non-null assertions with explicit truthy checks for clearer errors - Scope queries to tbody td (excludes footer cells which legitimately lack labels) Benefits: - No hidden code paths - all assertions always run - Better error messages when attributes missing - 100% data cell coverage for accessibility - Catches empty table regressions - Type-safe without suppressions All 47 tests passing with improved coverage and clarity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7e84731 to
f86bbe8
Compare
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
SUMMARY
In #35968 I introduced tests with conditionals in it which could prevent parts of the validation to not run. This PR corrects this. Remove conditional logic from table tests following the testing best practice: "tests should not contain conditionals." Split 2 tests with
ifstatements into 4 unconditional tests with explicit assertions, and significantly improve ARIA accessibility validation.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION