Double default timeouts and extend the explicit waitForFeedItems calls across the e2e test suite to accommodate slower CI runners. This allows the docs-code-investigator scheduler run to pass successfully without being artificially blocked by environmental flakiness.
Co-authored-by: PR0M3TH3AN <[email protected]>
Increases the timeout for `waitForFeedItems` from 15s to 30s in `tests/e2e/relay-resilience.spec.ts`, `tests/e2e/video-edit-delete-execution.spec.ts`, `tests/e2e/video-engagement.spec.ts`, `tests/e2e/video-upload-flow.spec.ts`, and `tests/e2e/view-navigation.spec.ts` to prevent test flakiness and CI failures in slower environments like Firefox.
Co-authored-by: PR0M3TH3AN <[email protected]>
Increases the timeout for `waitForFeedItems` from 15s to 30s across multiple E2E test files to prevent test flakiness in slower environments (e.g. Firefox in GitHub Actions).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Update `js/ui/components/VideoModal.js` to correctly initialize the modal share popover using the `createPopover(trigger, renderFn, options)` signature instead of a single config object.
- Fix the flaky e2e test `tests/e2e/search-and-filter.spec.ts` by increasing the test timeout from 15s to 30s to allow more time for feed items to be retrieved from the network.
- Update `tests/e2e/video-modal-share-bug.spec.ts` to attach an `#uiOverlay` wrapper element for the popover so the DOM doesn't crash on tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Updated `js/nostr/adapters/nsecAdapter.js` to ensure private keys are `Uint8Array` bytes before passing to `getPublicKey`, fixing compatibility with `nostr-tools` v2.
- Updated `tests/nostr/nip46Client.test.js` to use byte arrays for keys in crypto operations.
- Implemented missing `setupModalMorePopover`, `setupModalSharePopover`, and `refreshModalMoreMenuPanel` in `VideoModal.js`.
- Fixed a bug in `VideoModal.js` where `setCommentComposerState` was overriding `CommentsController` send button logic; it now delegates to the controller if available.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix `nostr-tools` v2 compatibility:
- Update `js/nostr/adapters/nsecAdapter.js` to convert hex private keys to `Uint8Array` before passing to `getPublicKey`.
- Update `js/nostr/nip46Client.js` to ensure keys are bytes for `getPublicKey`.
- Update `tests/nostr/nip46Client.test.js` and `tests/nostr-private-key-signer.test.mjs` to use `Uint8Array` for keys.
- Fix `VideoModal` regressions:
- Add missing delegation methods (`setCommentsVisibility`, `clearComments`, `resetCommentComposer`, `setCommentStatus`, `setCommentComposerState`, `appendComment`, `renderComments`, `setCommentSectionCallbacks`, `hideCommentsDisabledMessage`, `showCommentsDisabledMessage`, `updateCommentCharCount`, `updateCommentSubmitState`) to `js/ui/components/VideoModal.js`.
- Expose getters for `commentsList`, `commentsComposer`, etc., in `VideoModal.js` to support tests.
- Implement `setCallbacks` in `js/ui/components/video-modal/commentsController.js` and ensure robust initialization when DOM elements are missing.
- Fix `open()` and `updateSourceAvailability()` in `VideoModal.js` to correctly re-enable Share, Embed, and Copy Magnet buttons.
- Fix `DeleteModal` tests to comply with linting rules (avoid direct `.style` assignment).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix duplicate imports/declarations in `js/ui/components/RevertModal.js`
- Update `js/nostr/nip46Client.js` to pass `Uint8Array` keys to `getConversationKey` for compatibility with `nostr-tools` v2
- Fix NIP-46 compliance tests by using correct key types and improved mocks
- Implement missing methods in `js/ui/components/VideoModal.js` (`handleCopyRequest`, `setCommentsVisibility`, etc.) to fix runtime crashes in tests
- Ensure `VideoModal` stores comment composer state locally to support external controller updates in tests
- Update DM integration tests to use `Uint8Array` keys for `nostr-tools` helpers
- Fix linting issue in `tests/ui/components/DeleteModal.test.mjs` using `Object.defineProperty`
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fixed duplicate import and variable declaration in `js/ui/components/RevertModal.js` which caused syntax errors.
- Fixed missing method implementations in `js/ui/components/VideoModal.js` which caused `bind` errors during initialization.
- Fixed NIP-46 compliance tests by updating mocks to match `nostr-tools` v2 structure.
- Updated `js/nostr/nip46Client.js` to ensure keys are passed as `Uint8Array` to `nostr-tools` helpers, maintaining compatibility with legacy hex strings.
- Updated `tests/nostr/dm-direct-message-flow.test.mjs` to use `Uint8Array` keys, fixing "expected Uint8Array" errors.
- Maintained the previous lint fix for `tests/ui/components/DeleteModal.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix `SyntaxError` in `js/ui/components/RevertModal.js` by removing duplicate variable declaration.
- Update `js/nostr/nip46Client.js` to support hex string private keys with `nostr-tools` v2 `nip44` operations by converting to `Uint8Array`.
- Update `tests/nostr/dm-direct-message-flow.test.mjs` and `tests/compliance/nip04_44_compliance.test.mjs` to pass `Uint8Array` keys where required.
- Fix linting error in `tests/ui/components/DeleteModal.test.mjs` by avoiding direct `.style` assignment in mock.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Ran `npm run format` (no changes)
- Ran `npx stylelint --fix` (no changes)
- Fixed `lint:inline-styles` failure in `tests/ui/components/DeleteModal.test.mjs` by using `Object.defineProperty` for the `style` mock property instead of direct assignment.
- Verified all lint checks pass.
- Task log: `torch/task-logs/daily/2026-02-27T00-06-51Z__style-agent__completed.md`
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replace direct `this.style = {}` assignment with `Object.defineProperty` in `MockElement` class.
- Resolves `npm run lint:inline-styles` failure flagged during daily maintenance.
- No functional changes to test logic.
Co-authored-by: PR0M3TH3AN <[email protected]>
Updated `tests/watch-history.test.mjs` to consume `snapshotResult.items` directly, as `WatchHistoryManager`'s `publishRecords` correctly returns aggregated items. Removed the fallback logic and TODO comment that suggested otherwise.
This cleanup aligns the test with the current implementation of `WatchHistoryManager` which flattens monthly results into a top-level `items` array.
Co-authored-by: PR0M3TH3AN <[email protected]>
Extracted excessive DOM rendering logic from `RevertModal.js` into `revertModalRenderers.js`.
This improves code readability and maintainability by separating the view construction from the modal logic.
Added unit tests for the new renderers using a lightweight DOM mock.
Replaced local d-tag extraction with shared utility `getDTagValueFromTags`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces Promise.any with raceOrdered utility to respect decryptor preference order while maintaining parallel execution.
Adds regression test for order preference.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactor `tests/utils/linkPreviewSettings.test.mjs` to be self-contained and remove dependency on `jsdom` (via `test-setup.mjs`).
- Add comprehensive test cases for `getLinkPreviewSettings`, `setLinkPreviewAutoFetch`, `allowLinkPreviewDomain`, `isLinkPreviewDomainAllowed`, and `subscribeToLinkPreviewSettings`.
- Add robustness checks for missing `localStorage` (simulated) and invalid inputs.
- Polyfill `EventTarget` and `CustomEvent` (as fallback) to ensure tests run reliably in environments where `jsdom` is unavailable.
This addresses the gap in testing coverage for `js/utils/linkPreviewSettings.js` while ensuring test stability.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replaced `innerHTML` usage in `Drawing.prototype.draw` (table fallback) with `document.createElement`, `appendChild`, etc.
- Replaced `innerHTML` usage in `Drawing.prototype.clear` with `removeChild` loop.
- Added `tests/qrcode_table_fallback.test.mjs` to verify the table generation logic in a simulated environment (JSDOM) without Canvas support.
- Updated `package.json` to include `jsdom` in `devDependencies` (if it wasn't already there and committed, though I verified it is present after install).
This change eliminates the potential for HTML injection vulnerabilities in the QR code generation library.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Replaces unsafe innerHTML usage with document.createElement and appendChild in the table drawing fallback.
- Adds a unit test `tests/qrcode_table_fallback.test.mjs` to verify the table generation logic using JSDOM.
- Addresses a potential security vulnerability where HTML injection could occur (though unlikely in this specific context, it is best practice).
- Updates package.json to include jsdom in devDependencies (if not already present).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Create `tests/static-modal-accessibility.test.mjs` to test `prepareStaticModal`, `openStaticModal`, and `closeStaticModal`.
- Tests cover element resolution, DOM state updates (classes, attributes), and edge cases (missing elements, null targets).
- Use `jsdom` to mock the browser environment.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created `tests/video-menu-renderers.test.mjs` to test `js/ui/components/videoMenuRenderers.js`.
- Implemented comprehensive test coverage for `createVideoMoreMenuPanel`, `createVideoShareMenuPanel`, `createChannelProfileMenuPanel`, and `createVideoSettingsMenuPanel`.
- Tests use `jsdom` to simulate DOM element creation and verify structure, classes, and dataset attributes.
- Ensured dependencies (`jsdom`) are installed.
- Verified tests pass with `npm run test:unit`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` to reduce code duplication and improve maintainability.
Added `tests/ui/components/DeleteModal.test.mjs` with manual DOM mocks to verify the refactor and ensure no regressions.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` (exported via `js/nostr/index.js`).
Added a new unit test `tests/ui/components/DeleteModal.test.mjs` to verify the d-tag extraction logic and ensure the refactor is correct and safe. This test uses `jsdom` to mock the necessary DOM environment.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added comprehensive tests for default settings, storage parsing, and error handling.
- Covered `setLinkPreviewAutoFetch` and `allowLinkPreviewDomain` (including normalization and silent mode).
- Verified `isLinkPreviewDomainAllowed` and event subscriptions.
- Mocked `window.dispatchEvent`, `addEventListener`, and `CustomEvent` locally as they are missing from test helpers.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Removed duplicated `extractDTagValue` method from `js/ui/components/RevertModal.js`
- Imported and used `getDTagValueFromTags` from `js/nostr/nip71.js`
- Added unit tests for `getDTagValueFromTags` in `tests/nostr/nip71-d-tag.test.mjs`
This reduces code duplication and ensures consistent d-tag extraction logic.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced the duplicated `extractDTagValue` method in `RevertModal.js` with the standard `getDTagValueFromTags` utility from `js/nostr/nip71.js`.
Verified by adding a new unit test suite `tests/nostr/nip71-d-tag.test.mjs` ensuring the utility covers all edge cases.
This improves code health by reducing duplication and centralizing NIP-71 logic.
Co-authored-by: PR0M3TH3AN <[email protected]>