Introduces comprehensive unit tests for `pointerArrayToKey` in `tests/utils/pointer.test.mjs`.
The tests cover:
- Invalid inputs (non-arrays, short arrays)
- Type validation ('a' and 'e' support)
- Value normalization (trimming and lowercasing)
- Optional relay handling (trimming and type checking)
- Error conditions (empty values, non-string inputs)
These tests use the native Node.js test runner and follow existing project patterns.
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit introduces a new test file `tests/utils/video-timestamps.test.mjs`
providing comprehensive unit tests for the functions in `js/utils/videoTimestamps.js`.
The tests cover:
- `getVideoRootIdentifier`: extracting root IDs with fallback logic.
- `applyRootTimestampToVideosMap`: synchronizing timestamps across a map of videos.
- `syncActiveVideoRootTimestamp`: state updates, timestamp normalization, and modal interactions.
These tests help ensure the reliability of video timestamp handling and prevent regressions.
Co-authored-by: PR0M3TH3AN <[email protected]>
Extract duplicated SimpleEventEmitter class from multiple service files into a shared utility file `js/utils/eventEmitter.js`.
- Created `js/utils/eventEmitter.js` with unified implementation.
- Refactored `AuthService`, `NostrService`, `ModerationService`, and `PlaybackService` to use the shared class.
- Added support for constructor-defined context strings for improved error logging.
- Added comprehensive unit tests for `SimpleEventEmitter`.
- Verified changes with targeted service tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
Added comprehensive unit tests for js/utils/storagePointer.js, covering
normalization, parsing, derivation from URLs, and extraction from
Nostr tags. These tests improve coverage and ensure reliability of
core storage pointer handling logic.
Co-authored-by: PR0M3TH3AN <[email protected]>