mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Fixed failing unit tests identified during onboarding audit: - Mocked readRelays in tests/app-batch-fetch-profiles.test.mjs - Mocked hashtagPreferencesService.load in tests/profile-modal-controller.test.mjs - Updated browserslist db - Added ONBOARDING_REPORT.md Co-authored-by: PR0M3TH3AN <[email protected]>
2.2 KiB
2.2 KiB
Developer Onboarding Audit Report
Date: 2026-01-30 Agent: Jules
Summary
The onboarding process was audited by simulating a fresh developer checkout. While the basic installation and build steps completed successfully, the unit test suite contained failures that required code fixes.
Steps Executed
- Dependencies:
npm ci(Success) - Build:
npm run build:css(Success, with warning) - Format:
npm run format(Success) - Lint:
npm run lint(Success) - Tests:
npm run test:unit(Failure initially)
Findings & Fixes
1. Unit Test Failure: tests/app-batch-fetch-profiles.test.mjs
- Issue: The test failed with
expected a query per relay. 4 !== 2. - Cause: The test mocked
nostrClient.relaysandwriteRelaysbut notreadRelays. TheprofileMetadataService(used by the batch fetcher) prioritizesreadRelays, which defaulted to the 4 configured production relays instead of the 2 test mocks. - Fix: Updated the test to explicitly mock
nostrClient.readRelaysto match the test configuration.
2. Unit Test Failure: tests/profile-modal-controller.test.mjs
- Issue: The test failed with
TypeError: this.hashtagPreferencesService.load is not a function. - Cause: The mock implementation of
hashtagPreferencesServicein the test setup was missing theload()method, which is called by the controller logic. - Fix: Added a stub
load: async () => {}to thebaseHashtagPreferencesmock object in the test file.
3. Build Warning: caniuse-lite is outdated
- Issue:
npm run build:cssoutputs a warning:Browserslist: caniuse-lite is outdated. - Action: Executed
npx update-browserslist-db@latest. - Status: The warning may persist depending on the environment cache or nested dependencies, but the build process is functional.
Recommendations
- Tests: It is recommended to run unit tests in shards (
npm run test:unit:shard1etc.) locally if the full suite times out, as observed in this environment. - Documentation: The
CONTRIBUTING.mdguide is generally accurate.
Conclusion
The onboarding friction was primarily due to bit-rot in unit tests. These have been corrected. The environment is now ready for development.