Skip to content

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

Open
anshukaushik4700 wants to merge 2 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 2 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.

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.

1 participant