-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpr_desc.txt
More file actions
9 lines (7 loc) · 925 Bytes
/
pr_desc.txt
File metadata and controls
9 lines (7 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
🎯 **What:**
Added a dedicated test file (`tests/test_check_secret_data.mjs`) to verify the behavior of the `checkSecretData` function in `assets/js/dashboard.js`. The test specifically targets how the function handles malformed `secret_data` in `sessionStorage` and verifies that it securely alerts users when valid data is present.
📊 **Coverage:**
- Tests the error condition where `sessionStorage` contains malformed JSON, ensuring that execution is not halted and the error is cleanly logged (with a mock overriding `console.error` to catch the output).
- Tests the happy path where valid `secret_data` JSON is parsed, verifying that a success alert is properly constructed and inserted into the `main` element of the DOM.
✨ **Result:**
Test coverage has increased, providing a safety net to ensure that unexpected alterations to `sessionStorage` or malformed payloads do not crash the dashboard initialization.