Skip to content

test: add unit tests for statistics.js (Resubmission)#4972

Merged
walterbender merged 1 commit intosugarlabs:masterfrom
Inuth0603:test/statistics-clean
Feb 15, 2026
Merged

test: add unit tests for statistics.js (Resubmission)#4972
walterbender merged 1 commit intosugarlabs:masterfrom
Inuth0603:test/statistics-clean

Conversation

@Inuth0603
Copy link
Contributor

@Inuth0603 Inuth0603 commented Dec 31, 2025

Reason for Resubmission:
My previous PR #4970 was accidentally closed by a typo in another user's commit (3d56534) which said "Closes #4970" by mistake. My code was never merged.

Description
Added unit tests for js/widgets/statistics.js to verify the displayInfo logic and improve code coverage.

Changes

  • Created js/widgets/statistics.test.js.
  • Added module export to js/widgets/statistics.js.
  • Mocked docById, Chart, and widgetWindows for testing.

Testing

  • Verified locally (1 Pass, 100% Coverage).
Screenshot 2026-02-16 001024

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

2 similar comments
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603 Inuth0603 force-pushed the test/statistics-clean branch from 800c2cd to d8f8bd5 Compare December 31, 2025 18:14
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603 Inuth0603 force-pushed the test/statistics-clean branch from d8f8bd5 to ef65b77 Compare December 31, 2025 18:20
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603 Inuth0603 force-pushed the test/statistics-clean branch from ef65b77 to f5800b5 Compare December 31, 2025 18:30
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 1, 2026

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603 Inuth0603 force-pushed the test/statistics-clean branch from 13ce9af to a3670c8 Compare February 15, 2026 18:47
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603 Inuth0603 force-pushed the test/statistics-clean branch from a3670c8 to be9db1e Compare February 15, 2026 18:52
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Inuth0603
Copy link
Contributor Author

Hey @walterbender, I've gone ahead and bumped the coverage up to 100% across the board (statements, branches, functions, lines).

Added tests for the parts that were missing — the onclose/onmaximize callbacks, the chart rendering callback in doAnalytics (both maximized and normal states), and more thorough checks on displayInfo output.

7 tests total, all passing. Rebased on latest master, single commit.

Let me know if anything needs changing!

@walterbender walterbender merged commit ab8f8df into sugarlabs:master Feb 15, 2026
7 checks passed
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