Skip to content

Tests: Achieve 100% coverage for loader.js#5127

Open
Ronak-si wants to merge 1 commit intosugarlabs:masterfrom
Ronak-si:fix-loader-test-coverage
Open

Tests: Achieve 100% coverage for loader.js#5127
Ronak-si wants to merge 1 commit intosugarlabs:masterfrom
Ronak-si:fix-loader-test-coverage

Conversation

@Ronak-si
Copy link

This PR adds a comprehensive test suite for js/loader.js using Jest and JSDOM.

Changes:

Created js/tests/loader.test.js.

Mocked requirejs and i18next global dependencies.

Added test cases for successful initialization, language switching, and DOM updates.

Added error-handling test cases to ensure 100% branch coverage for console.error logs.

Verification: Ran npm test js/tests/loader.test.js -- --coverage. All 5 tests passed with 100% statement and branch coverage for the target file.

Closes#5123

@github-actions
Copy link
Contributor

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

@omsuneri omsuneri self-requested a review January 10, 2026 17:51
@vanshika2720
Copy link
Contributor

@Ronak-si run prettier on modified files and resolve conflicts.

@Ronak-si Ronak-si force-pushed the fix-loader-test-coverage branch from fd58336 to 3b7b086 Compare March 2, 2026 08:59
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

loader.test.js

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