Commit Graph
16 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN fd5e6fef6b test: add missing tests for LinkPreviewSettings utility
- 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]>
2026-02-26 17:44:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN 1bcf88e584 test: add unit tests for linkPreviewSettings utility
- Creates `tests/utils/linkPreviewSettings.test.mjs` to cover `js/utils/linkPreviewSettings.js`.
- Implements comprehensive tests for default state, storage persistence, domain management, event emission, and subscription.
- Polyfills JSDOM Event constructors in the test file to support `CustomEvent` emission.
- Ensures tests are isolated using `beforeEach`/`afterEach` to clear `localStorage`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-11 12:28:42 +00:00
google-labs-jules[bot]andPR0M3TH3AN f45750489e test(utils): add unit tests for videoTimestamps.js
Adds comprehensive unit tests for `js/utils/videoTimestamps.js` using the native Node.js test runner.

- Covers `getVideoRootIdentifier`, `applyRootTimestampToVideosMap`, and `syncActiveVideoRootTimestamp`.
- Verifies handling of invalid inputs, edge cases (e.g., missing IDs, type mismatches), and state updates.
- Ensures robust timestamp synchronization logic.

This addresses the testing gap identified in `js/utils/videoTimestamps.js`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 04:23:23 +00:00
google-labs-jules[bot]andPR0M3TH3AN b246e431e5 Refactor publishVideo method in NostrClient
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-09 01:54:07 +00:00
thePR0M3TH3AN 6fcb18349b Merge pull request #2245 from PR0M3TH3AN/test/hex-utils-coverage-3841884006452707287
🧪 Add tests for hex utils
2026-02-08 10:55:13 -05:00
google-labs-jules[bot]andPR0M3TH3AN 01f9f61010 test: add unit tests for hex utils
- Added `tests/utils/hex.test.mjs`
- Covered `normalizeHexString` with various input types
- Covered `HEX64_REGEX` with valid and invalid cases
- Verified aliases `normalizeHexId` and `normalizeHexPubkey`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 04:20:48 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5fb7299850 test: add unit tests for sanitizeProfileMediaUrl and fix bugs
- Add `tests/utils/profileMedia.test.mjs` with comprehensive test cases.
- Fix `sanitizeProfileMediaUrl` to correctly trim whitespace after removing quotes.
- Fix `sanitizeProfileMediaUrl` to correctly detect and normalize `ipfs/` paths (without protocol).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:36:59 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8c8b8fb29a test: add tests for card source visibility logic
- Added `tests/utils/cardSourceVisibility.test.mjs` to test `updateVideoCardSourceVisibility`.
- Covered scenarios for owner visibility, healthy sources, pending sources, and failed sources.
- Verified that card is hidden only when both sources (URL and Stream) are failed.
- Ensured graceful handling of null/undefined inputs.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:23:56 +00:00
thePR0M3TH3AN 566c2dbf89 Merge pull request #2204 from PR0M3TH3AN/test/video-pointer-tests-15855649223064850700
Add unit tests for videoPointer.js
2026-02-07 19:15:03 -05:00
google-labs-jules[bot]andPR0M3TH3AN 01005eacb9 test(utils): add unit tests for videoPointer.js resolution logic
Adds comprehensive unit tests for `resolveVideoPointer` in `js/utils/videoPointer.js`.
The new tests cover:
- Happy paths for address (a-tag) and event (e-tag) pointers.
- Priority logic (dTag > videoRootId > fallbackEventId).
- Input normalization (trimming, lowercasing).
- Relay inclusion in pointer arrays.
- Default kind handling (fallback to 30078).
- Edge cases and invalid inputs returning null.

This improves test coverage for core video pointer resolution utility.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:05:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN 06865e5f46 test(utils): add unit tests for domUtils
- Added `tests/utils/domUtils.test.mjs` to test `escapeHTML` and `removeTrackingScripts`.
- Verified tests pass with `node:test` and JSDOM.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:14:18 +00:00
thePR0M3TH3AN cc7fe64e90 Merge pull request #1946 from PR0M3TH3AN/ai/dead-code-20240123-13702536329573366933
chore(ai): remove dead code (agent)
2026-01-30 10:05:35 -05:00
google-labs-jules[bot]andPR0M3TH3AN ce2c30574c test(ai): improve unit test coverage and stability (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 11:39:38 +00:00
google-labs-jules[bot]andPR0M3TH3AN 40e809245a chore(ai): remove dead code (agent)
Removed unused exports and functions identified as dead code.
- Removed unused exports from `js/utils/storage.js`, `js/utils/storagePointer.js`, `js/utils/videoTags.js`, `js/ui/moderationCopy.js`.
- Removed unused function `updateTagPillStrip` from `js/ui/components/tagPillList.js` and associated tests.
- Updated `tests/utils/video-tags.test.mjs` to remove test for private function.
- Added `artifacts/depcheck.json` showing dependency analysis.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-29 20:29:42 +00:00
thePR0M3TH3AN d235839e22 Fix video deduper timestamp comparison 2025-10-27 09:57:12 -04:00
thePR0M3TH3AN 8f5d402386 Add video tag collection helper and tests 2025-10-23 11:19:42 -04:00