mirror of
https://github.com/cassandra/home-information.git
synced 2026-04-20 06:29:50 -04:00
* Add JavaScript unit tests for auto-view.js using QUnit - Set up QUnit testing framework with local vendoring (no CDN dependency) - Create comprehensive test suite for auto-view.js core functions: * throttle() - timing behavior and edge cases * shouldAutoSwitch() - idle timeout decision logic * isPassiveEventSupported() - feature detection and caching * recordInteraction() and state management functions - Add test runner HTML file that works offline - Document testing approach and usage in README.md - All tests focus on business logic, avoid testing framework internals - Establishes reusable pattern for testing other JS modules * Fix test assertion for shouldAutoSwitch 60s threshold behavior The shouldAutoSwitch function uses >= comparison, so at exactly 60 seconds it returns true (should auto-switch). Updated test to match actual behavior. Also added Node.js test runner for command-line testing capability. * Add master test runner for all JavaScript tests - Created test-all.html that runs all JavaScript module tests in one page - Updated README.md with improved workflow for single-URL testing - Added instructions for adding future JavaScript modules to master runner - Maintains individual test runners for focused debugging This addresses the practical concern of needing to visit multiple URLs as JavaScript test coverage grows. * Organize JavaScript testing documentation - Created high-level documentation at docs/dev/frontend/javascript-testing.md - Covers testing philosophy, framework choice, and best practices - Uses auto-view.js as reference implementation example - Streamlined tests/README.md to focus on practical usage - Follows project documentation organization patterns - Maintains concise, maintainable approach with code references * Remove redundant README.md, consolidate all JS testing docs - Removed src/hi/static/tests/README.md (duplicate content) - Made docs/dev/frontend/javascript-testing.md completely self-contained - Added detailed code examples for adding new tests - Single source of truth for JavaScript testing documentation * Add comprehensive JavaScript unit tests for high-value modules - svg-utils.js: 150+ test cases for SVG transform string parsing with regex edge cases - main.js: Tests for generateUniqueId, cookie parsing/formatting with URL encoding - video-timeline.js: Tests for VideoConnectionManager array logic and caching algorithms - watchdog.js: Tests for timer management and restart logic simulation - Updated test-all.html with proper module loading order (main.js first) - Fixed svg-utils test assertions to match actual regex behavior - Enhanced Node.js test runner with better mocking (though some modules too DOM-heavy) All JavaScript tests now pass in browser - establishes comprehensive testing coverage for business logic functions across multiple modules. * Add JavaScript testing documentation links - Added link to javascript-testing.md in frontend-guidelines.md - Added link to javascript-testing.md in testing-guidelines.md - Ensures JavaScript testing approach is discoverable from main guideline docs