Skip to content

Add unit tests for tooltip summary data and conditional dimension display#32

Merged
david-mears-2 merged 6 commits intopopulate-tooltips-with-summary-datafrom
copilot/update-use-plot-tooltips-tests
Jan 19, 2026
Merged

Add unit tests for tooltip summary data and conditional dimension display#32
david-mears-2 merged 6 commits intopopulate-tooltips-with-summary-datafrom
copilot/update-use-plot-tooltips-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 16, 2026

PR #30 added summary statistics (median, mean, 95% confidence interval) to plot tooltips and changed how dimensions are conditionally displayed, but the unit tests weren't updated to cover this new content.

Changes

  • New test: summary data rendering - Verifies median, mean, and CI values from summaryTableData appear correctly formatted in tooltip HTML
  • New test: negative CI handling - Tests the sign logic when confidence intervals cross zero (negative lower bound → positive upper gets + prefix)
  • New test: missing data gracefully handled - Confirms tooltip still renders when no matching summary row exists
  • Updated test: conditional row dimension display - Verifies that the row dimension (e.g., Disease) is shown in the tooltip when it differs from the color dimension (e.g., Location), and that it appears only once when it matches the color dimension

Example test setup

dataStore.summaryTableData = [
  {
    [Dimension.LOCATION]: 'AFG',
    [Dimension.DISEASE]: 'Cholera',
    [SummaryTableColumn.MEDIAN]: 1234.56,
    [SummaryTableColumn.MEAN]: 1456.78,
    [SummaryTableColumn.CI_LOWER]: 789.12,
    [SummaryTableColumn.CI_UPPER]: 2345.67,
  } as SummaryTableDataRow,
];

const tooltip = tooltipCallback({ x: 1, y: 2, metadata: afgPointMetadata.metadata! });

expect(tooltip).toContain('Median: <strong>1234.56</strong>');
expect(tooltip).toContain('Mean: <strong>1456.78</strong>');
expect(tooltip).toContain('95% confidence interval:');

Test count: 4 → 7 tests for usePlotTooltips.spec.ts

Original prompt

Update the unit tests of usePlotTooltips composable to take into account the new content for tooltips added in the PR #30


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 16, 2026 19:31
Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Copilot AI changed the title [WIP] Update unit tests for usePlotTooltips composable Add unit tests for tooltip summary data (median, mean, 95% CI) Jan 16, 2026
Copilot AI requested a review from david-mears-2 January 16, 2026 19:37
@david-mears-2
Copy link
Copy Markdown
Contributor

@copilot Use git diff to find what exact lines changed between the relevant branch populate-tooltips-with-summary-data and the target branch of the PR rename-enums, because you did not actually test all of the changes in the diff.

…tips

Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 16, 2026

@copilot Use git diff to find what exact lines changed between the relevant branch populate-tooltips-with-summary-data and the target branch of the PR rename-enums, because you did not actually te...

After examining the diff between populate-tooltips-with-summary-data and rename-enums, I added an assertion to verify that the row dimension is displayed when different from the color dimension (commit 7b8abd3). The test now checks that when colorDimension is LOCATION and dimensions.row is DISEASE, the tooltip correctly shows both dimensions.

Copilot AI changed the title Add unit tests for tooltip summary data (median, mean, 95% CI) Add unit tests for tooltip summary data and conditional dimension display Jan 16, 2026
@david-mears-2
Copy link
Copy Markdown
Contributor

@copilot Add complementary test cases that complement your last commit: test that only one of those dimensions is shown when only one should be.

…imension

Co-authored-by: david-mears-2 <60350599+david-mears-2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 19, 2026

@copilot Add complementary test cases that complement your last commit: test that only one of those dimensions is shown when only one should be.

Added complementary assertions in commit 05db003. The "generates tooltip HTML for disease dimension" test now verifies that when colorDimension equals dimensions.row (both DISEASE), the row dimension appears only once in the tooltip (in the color dimension section), not duplicated as a separate row dimension entry.

@david-mears-2
Copy link
Copy Markdown
Contributor

Added a final human-written commit to remove a test case I didn't care about, be more explicit in expectations of row dimensions per test, and remove most comments.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.35%. Comparing base (2682e0c) to head (2b95c6a).
⚠️ Report is 7 commits behind head on populate-tooltips-with-summary-data.

Additional details and impacted files
@@                           Coverage Diff                           @@
##           populate-tooltips-with-summary-data      #32      +/-   ##
=======================================================================
+ Coverage                                96.87%   97.35%   +0.48%     
=======================================================================
  Files                                       18       18              
  Lines                                      416      416              
  Branches                                   100      100              
=======================================================================
+ Hits                                       403      405       +2     
+ Misses                                      12       11       -1     
+ Partials                                     1        0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-mears-2 david-mears-2 marked this pull request as ready for review January 19, 2026 15:38
@david-mears-2 david-mears-2 merged commit c72cf02 into populate-tooltips-with-summary-data Jan 19, 2026
4 checks passed
@david-mears-2 david-mears-2 deleted the copilot/update-use-plot-tooltips-tests branch January 19, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants