Skip to content

Added comprehensive tests for loader (95.58% coverage)#6130

Open
anshukaushik4700 wants to merge 4 commits intosugarlabs:masterfrom
anshukaushik4700:test/increasing_coverage_in_loader.test.js
Open

Added comprehensive tests for loader (95.58% coverage)#6130
anshukaushik4700 wants to merge 4 commits intosugarlabs:masterfrom
anshukaushik4700:test/increasing_coverage_in_loader.test.js

Conversation

@anshukaushik4700
Copy link
Contributor

Summary

Adds comprehensive test coverage for loader.js with 22 tests covering the full bootstrap lifecycle — i18n initialization, DOM updates, highlight.js loading, Materialize integration, RequireJS configuration, async retry logic, fatal error paths, and all error callbacks.

Changes

22 comprehensive tests:

  • requirejs.config validation (3)
  • Global flags (1)
  • Full success path (1)
  • i18next init error handling (2)
  • changeLanguage error handling (1)
  • DOMContentLoaded (document loading state) (1)
  • languageChanged event (1)
  • highlight.js loading (3)
  • updateContent early-return guard (1)
  • Materialize / M.AutoInit (2)
  • waitForGlobals retry loop (1)
  • PRELOADED_SCRIPTS define() (2)
  • Fatal createjs missing path (1)
  • activity/activity errback (1)
  • Core bootstrap errback (1)

Coverage Achieved

loader.js:

  • Statements: 95.58% ✅
  • Branches: 94.11% ✅
  • Functions: 90.9% ✅
  • Lines: 96.92% ✅

Verification

✅ Tests: 22 passed, 22 total
✅ All tests passing
✅ No failures
✅ Professional test patterns
Screenshot 2026-03-07 040857
Screenshot 2026-03-07 040908

Coverage Verification ✅

Verified locally: loader.js | 95.58 | 94.11 | 90.9 | 96.92 |

✅ Statements: 95.58%
✅ Branches: 94.11%
✅ Functions: 90.9%
✅ Lines: 96.92%

Command: npm test loader.test.js -- --coverage

PR Category

  • Bug Fix
  • Performance
  • Features
  • Tests
  • Documentation

@github-actions github-actions bot added the tests Adds or updates test coverage label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

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

@anshukaushik4700
Copy link
Contributor Author

@walterbender @omsuneri ready for review.

@Jetshree
Copy link
Contributor

Jetshree commented Mar 8, 2026

i can see in the commit history of this file that the license header was removed in this commit.
@Ashutoshx7 is the author of this file.
@anshukaushik4700 can you please restore the license header?
Reference: commit history of loader.test.js

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

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

Failed Tests:

GraphicsBlocks.test.js

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

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

Failed Tests:

GraphicsBlocks.test.js

@anshukaushik4700
Copy link
Contributor Author

@Jetshree Thanks for flagging it! I've restored the original license header crediting @Ashutoshx7 . Also synced my branch with the latest master. All 22 tests passing with 95.58% coverage maintained. ✅

Regarding the GraphicsBlocks.test.js CI failure — I haven't touched that file at all. I tested it locally and it appears to be a pre-existing issue in the test file itself, unrelated to my changes. My loader.test.js changes are completely isolated. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Adds or updates test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants