What needs testing?
->The LegoWidget implementation in js/widgets/legobricks.js, specifically its core logic methods:
-_calculateFallbackFrequency()
-addRowBlock()
-clearBlocks()
These functions handle frequency computation, block management, and internal state reset, and are critical to the widget’s functionality.
Current coverage:-
->There is currently no test coverage for legobricks.js.
-> The file (~3000+ lines) is one of the largest in the codebase and remains completely untested, making it a major coverage gap in the js/widgets directory.
Proposed approach:-
-> Introduce initial unit tests focusing on deterministic, non-UI logic:
-> Test _calculateFallbackFrequency() using known pitch references (e.g., A4 ≈ 440 Hz), multiple pitch values, and edge octaves
-> Test addRowBlock() to verify correct insertion and duplicate handling logic
-> Test clearBlocks() to ensure all internal state is reset properly
Keep the scope minimal and focused on core logic, avoiding UI rendering or complex integrations. Follow existing testing patterns used in other widget test files.
Checklist:-
📚 See Testing Guide for how to write block tests.
🙋🏾🙋🏼 Questions: Community Matrix Server.
What needs testing?
->The LegoWidget implementation in js/widgets/legobricks.js, specifically its core logic methods:
-_calculateFallbackFrequency()
-addRowBlock()
-clearBlocks()
These functions handle frequency computation, block management, and internal state reset, and are critical to the widget’s functionality.
Current coverage:-
->There is currently no test coverage for legobricks.js.
-> The file (~3000+ lines) is one of the largest in the codebase and remains completely untested, making it a major coverage gap in the js/widgets directory.
Proposed approach:-
-> Introduce initial unit tests focusing on deterministic, non-UI logic:
-> Test _calculateFallbackFrequency() using known pitch references (e.g., A4 ≈ 440 Hz), multiple pitch values, and edge octaves
-> Test addRowBlock() to verify correct insertion and duplicate handling logic
-> Test clearBlocks() to ensure all internal state is reset properly
Keep the scope minimal and focused on core logic, avoiding UI rendering or complex integrations. Follow existing testing patterns used in other widget test files.
Checklist:-
📚 See Testing Guide for how to write block tests.
🙋🏾🙋🏼 Questions: Community Matrix Server.