# Test Audit Report - 2026-02-15 ## Summary - **Runner**: Custom (`scripts/run-unit-tests.mjs`) - **Command**: `npx c8 npm run test:unit` - **Status**: PASS - **Coverage**: 49.92% Lines, 49.92% Statements, 46.29% Functions, 57.18% Branches ## Flakiness Check - **Error**: Flakiness check timed out after 400s ## Suspicious Tests - **tests/admin-list-store.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/app-batch-fetch-profiles.test.mjs**: - Console usage inside test - **tests/auth-service.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/comment-thread-service.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/compliance/nip07_compliance.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/discussion-count-service.test.mjs**: - Console usage inside test - **tests/dm-normalization.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/event-schemas.test.mjs**: - Console usage inside test - **tests/feed-engine.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/hashtag-preferences.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/minimal-channel-profile.test.mjs**: - No obvious assertions found - **tests/minimal-webtorrent.test.mjs**: - No obvious assertions found - **tests/modal-accessibility.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/moderation/submit-report.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/moderation/video-card.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nip07-concurrency.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/client.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/comment-events.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/countDiagnostics.test.mjs**: - Console usage inside test - **tests/nostr/dm-direct-message-flow.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/dmDecryptWorkerClient.test.mjs**: - Console usage inside test - **tests/nostr/dmSignalEvents.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/integration-remote-flow.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/nip04WorkerClient.test.mjs**: - Console usage inside test - **tests/nostr/nip07Permissions.test.js**: - Uses setTimeout/sleep (brittle) - **tests/nostr/sessionActor.test.mjs**: - Test is focused (.only) or skipped (.skip) - **tests/nostr/sign-request-queue.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/toolkit.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr/watchHistory.test.js**: - Uses setTimeout/sleep (brittle) - **tests/nostr-boost-actions.test.mjs**: - Console usage inside test - **tests/nostr-count-fallback.test.mjs**: - Console usage inside test - **tests/nostr-delete-flow.test.mjs**: - Console usage inside test - **tests/nostr-login-permissions.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-nip46-queue.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-private-key-signer.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-publish-rejection.test.mjs**: - Console usage inside test - **tests/nostr-rebroadcast-guard.test.mjs**: - Console usage inside test - **tests/nostr-send-direct-message.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-service-access-control.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-signer-race.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/nostr-view-event-bindings.test.mjs**: - Console usage inside test - **tests/nostr-view-events.test.mjs**: - Console usage inside test - **tests/nwc-client.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/performance/resolvePostedAt.test.mjs**: - Console usage inside test - **tests/profile-cache.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/profile-modal-controller.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/race/nostr-client-init-race.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/services/exploreDataService.test.mjs**: - Console usage inside test - **tests/services/link-preview-service.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/services/playbackService_forcedSource.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/services/profileMetadataService.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/services/relay-health-service.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/services/trustBootstrap.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/sign-request-queue.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/state/cache.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/subscriptions-feed.test.mjs**: - Console usage inside test - **tests/subscriptions-manager.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/torrent/toast-service.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/ui/components/debug_hashtag_strip_helper.test.mjs**: - No obvious assertions found - Console usage inside test - **tests/ui/profileModalController-addProfile.test.mjs**: - Console usage inside test - **tests/ui/uploadModal-integration.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/ui/uploadModal-reset.test.mjs**: - Console usage inside test - **tests/ui/url-health-controller.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/unit/client-count-resilience.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/unit/notificationController.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/unit/ui/videoModalController.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/user-blocks.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/utils/domUtils.test.mjs**: - Console usage inside test - **tests/video-card-source-visibility.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/video-modal-accessibility.test.mjs**: - Console usage inside test - **tests/view-counter.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/watch-history-feed.test.mjs**: - Console usage inside test - **tests/watch-history.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/watchHistory/watch-history-telemetry.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/webtorrent-handlers.test.mjs**: - Uses setTimeout/sleep (brittle) - **tests/webtorrent-regression.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test - **tests/zap-shared-state.test.mjs**: - Console usage inside test - **tests/zap-split.test.mjs**: - Uses setTimeout/sleep (brittle) - Console usage inside test ## Coverage Gaps (< 70%) - **js/accessControl.js**: 25.52% (Lines) - **js/adminListStore.js**: 9.01% (Lines) - **js/app.js**: 35.93% (Lines) - **js/applicationContext.js**: 66.66% (Lines) - **js/channelProfile.js**: 22.61% (Lines) - **js/directMessagesStore.js**: 50.59% (Lines) - **js/dmDecryptor.js**: 69.58% (Lines) - **js/embedDiagnostics.js**: 5.08% (Lines) - **js/gridHealth.js**: 24.41% (Lines) - **js/hashView.js**: 20% (Lines) - **js/historyView.js**: 10.13% (Lines) - **js/magnets.js**: 13.54% (Lines) - **js/nostrClientRegistry.js**: 69.74% (Lines) - **js/nostrPublish.js**: 56.74% (Lines) - **js/nwcSettings.js**: 12.16% (Lines) - **js/r2.js**: 57.14% (Lines) - **js/reactionCounter.js**: 6.14% (Lines) - **js/relayManager.js**: 49.93% (Lines) - **js/sidebarLoading.js**: 12.12% (Lines) - **js/subscriptions.js**: 62.05% (Lines) - **js/urlHealthObserver.js**: 37.31% (Lines) - **js/userBlocks.js**: 25.86% (Lines) - **js/videoEventUtils.js**: 11.96% (Lines) - **js/viewCounter.js**: 38.42% (Lines) - **js/watchHistoryDebug.js**: 23.31% (Lines) - **js/watchHistoryService.js**: 27.23% (Lines) - **js/webtorrent.js**: 39.92% (Lines) - **js/app/authSessionCoordinator.js**: 9.18% (Lines) - **js/app/feedCoordinator.js**: 32.44% (Lines) - **js/app/modalCoordinator.js**: 35.85% (Lines) - **js/app/moderationCoordinator.js**: 33.33% (Lines) - **js/app/playbackCoordinator.js**: 16.36% (Lines) - **js/app/routerCoordinator.js**: 28.4% (Lines) - **js/app/uiCoordinator.js**: 65.48% (Lines) - **js/attachments/attachmentUtils.js**: 16.66% (Lines) - **js/dom/cardObserver.js**: 44.01% (Lines) - **js/feedEngine/engine.js**: 18.7% (Lines) - **js/feedEngine/kidsAudienceFilterStage.js**: 14.9% (Lines) - **js/feedEngine/sorters.js**: 52.75% (Lines) - **js/feedEngine/sources.js**: 12.18% (Lines) - **js/feedEngine/stages.js**: 61.37% (Lines) - **js/feedEngine/utils.js**: 69.79% (Lines) - **js/feedEngine/watchHistoryFeed.js**: 5.64% (Lines) - **js/nostr/client.js**: 52.27% (Lines) - **js/nostr/nip46Client.js**: 55.18% (Lines) - **js/nostr/nip46Connector.js**: 47.11% (Lines) - **js/nostr/nip46LoggingUtils.js**: 46.83% (Lines) - **js/nostr/publishHelpers.js**: 32.17% (Lines) - **js/nostr/reactionEvents.js**: 48.54% (Lines) - **js/nostr/signerHelpers.js**: 57.57% (Lines) - **js/nostr/toolkit.js**: 69.93% (Lines) - **js/nostr/videoPublisher.js**: 47.03% (Lines) - **js/nostr/viewEventBindings.js**: 28.57% (Lines) - **js/nostr/viewEvents.js**: 37.4% (Lines) - **js/nostr/watchHistory.js**: 58.14% (Lines) - **js/nostr/adapters/nip07Adapter.js**: 58.26% (Lines) - **js/nostr/managers/ConnectionManager.js**: 57.4% (Lines) - **js/nostr/managers/PersistenceManager.js**: 48.87% (Lines) - **js/nostr/managers/SignerManager.js**: 54.43% (Lines) - **js/payments/lnurl.js**: 11% (Lines) - **js/payments/nwcClient.js**: 11.33% (Lines) - **js/payments/platformAddress.js**: 21.03% (Lines) - **js/payments/platformFee.js**: 14.86% (Lines) - **js/payments/zapNotifications.js**: 5.47% (Lines) - **js/payments/zapReceiptValidator.js**: 9.66% (Lines) - **js/payments/zapRequests.js**: 17% (Lines) - **js/payments/zapSharedState.js**: 26.78% (Lines) - **js/payments/zapSplit.js**: 17.47% (Lines) - **js/services/attachmentService.js**: 53.04% (Lines) - **js/services/dmNostrService.js**: 11.4% (Lines) - **js/services/dmNotificationManager.js**: 68.59% (Lines) - **js/services/hashtagPreferencesService.js**: 67.71% (Lines) - **js/services/moderationActionController.js**: 69% (Lines) - **js/services/moderationService.js**: 66.95% (Lines) - **js/services/nostrService.js**: 47.07% (Lines) - **js/services/nwcSettingsService.js**: 52.59% (Lines) - **js/services/r2Service.js**: 66.72% (Lines) - **js/services/relaySubscriptionService.js**: 68.8% (Lines) - **js/services/s3Service.js**: 55.13% (Lines) - **js/services/watchHistoryTelemetry.js**: 22.71% (Lines) - **js/services/authProviders/index.js**: 63.26% (Lines) - **js/services/authProviders/nip46.js**: 18.21% (Lines) - **js/services/authProviders/nsec.js**: 26.7% (Lines) - **js/state/cache.js**: 53.88% (Lines) - **js/storage/r2-mgmt.js**: 15.35% (Lines) - **js/storage/r2-s3.js**: 12.5% (Lines) - **js/storage/s3-client.js**: 45.61% (Lines) - **js/storage/s3-multipart.js**: 6.25% (Lines) - **js/ui/ModalManager.js**: 64.37% (Lines) - **js/ui/ambientBackground.js**: 33.02% (Lines) - **js/ui/appChromeController.js**: 57.1% (Lines) - **js/ui/applicationBootstrap.js**: 60.78% (Lines) - **js/ui/loginModalController.js**: 40.56% (Lines) - **js/ui/moreMenuController.js**: 29.12% (Lines) - **js/ui/notificationController.js**: 69.17% (Lines) - **js/ui/profileIdentityController.js**: 10.05% (Lines) - **js/ui/profileModalController.js**: 52.4% (Lines) - **js/ui/shareNostrController.js**: 66.66% (Lines) - **js/ui/subscriptionHistoryController.js**: 11.29% (Lines) - **js/ui/tagPreferenceMenuController.js**: 63.11% (Lines) - **js/ui/urlHealthController.js**: 69.06% (Lines) - **js/ui/videoListViewController.js**: 18.75% (Lines) - **js/ui/watchHistoryController.js**: 13.2% (Lines) - **js/ui/zapController.js**: 11.53% (Lines) - **js/ui/components/DeleteModal.js**: 20.52% (Lines) - **js/ui/components/EmbedPlayerModal.js**: 35.04% (Lines) - **js/ui/components/EmbedVideoModal.js**: 19.51% (Lines) - **js/ui/components/EventDetailsModal.js**: 11.11% (Lines) - **js/ui/components/FeedInfoPopover.js**: 27.27% (Lines) - **js/ui/components/RevertModal.js**: 49.56% (Lines) - **js/ui/components/ShareNostrModal.js**: 23.04% (Lines) - **js/ui/components/SimilarContentCard.js**: 64.66% (Lines) - **js/ui/components/UploadModal.js**: 60.34% (Lines) - **js/ui/components/VideoCard.js**: 64.87% (Lines) - **js/ui/components/VideoModal.js**: 53.62% (Lines) - **js/ui/components/nip71FormManager.js**: 57.57% (Lines) - **js/ui/components/revertModalRenderers.js**: 2.5% (Lines) - **js/ui/components/video-modal/commentsController.js**: 54.13% (Lines) - **js/ui/components/video-modal/moderationController.js**: 68.37% (Lines) - **js/ui/dm/AppShell.js**: 36.48% (Lines) - **js/ui/dm/Avatar.js**: 7.01% (Lines) - **js/ui/dm/Composer.js**: 1.63% (Lines) - **js/ui/dm/ContactRow.js**: 5.26% (Lines) - **js/ui/dm/ConversationList.js**: 4.29% (Lines) - **js/ui/dm/DMPrivacySettings.js**: 1.38% (Lines) - **js/ui/dm/DMRelaySettings.js**: 1.25% (Lines) - **js/ui/dm/DMSettingsModalController.js**: 17.24% (Lines) - **js/ui/dm/DayDivider.js**: 8.33% (Lines) - **js/ui/dm/MessageBubble.js**: 2.59% (Lines) - **js/ui/dm/MessageThread.js**: 3.66% (Lines) - **js/ui/dm/NotificationCenter.js**: 10.04% (Lines) - **js/ui/dm/ZapInterface.js**: 5.04% (Lines) - **js/ui/dm/ZapReceiptList.js**: 5% (Lines) - **js/ui/profileModal/ProfileAdminController.js**: 64.74% (Lines) - **js/ui/profileModal/ProfileDirectMessageActions.js**: 10.44% (Lines) - **js/ui/profileModal/ProfileDirectMessageController.js**: 49.77% (Lines) - **js/ui/profileModal/ProfileDirectMessageHelper.js**: 13.06% (Lines) - **js/ui/profileModal/ProfileDirectMessageRenderer.js**: 26.34% (Lines) - **js/ui/profileModal/ProfileHashtagController.js**: 68.89% (Lines) - **js/ui/profileModal/ProfileRelayController.js**: 33.47% (Lines) - **js/ui/profileModal/ProfileStorageController.js**: 28.06% (Lines) - **js/ui/profileModal/ProfileWalletController.js**: 46.43% (Lines) - **js/ui/views/VideoListView.js**: 53.41% (Lines) - **js/utils/cryptoUtils.js**: 17.39% (Lines) - **js/utils/formatters.js**: 64.28% (Lines) - **js/utils/magnetValidators.js**: 27.11% (Lines) - **js/utils/nostrHelpers.js**: 56.86% (Lines) - **js/utils/pointerNormalization.js**: 43.9% (Lines) - **js/utils/qrcode.js**: 29.81% (Lines) - **js/utils/simpleEventEmitter.js**: 37.5% (Lines) - **js/utils/storage.js**: 42.1% (Lines) - **js/utils/storagePointer.js**: 68.78% (Lines) - **js/webtorrent/lib/file-iterator.js**: 27.08% (Lines) - **js/webtorrent/lib/file.js**: 38.77% (Lines) - **js/webtorrent/lib/peer.js**: 34.83% (Lines) - **js/webtorrent/lib/rarity-map.js**: 57.14% (Lines) - **js/webtorrent/lib/selections.js**: 51.89% (Lines) - **js/webtorrent/lib/server.js**: 15.26% (Lines) - **js/webtorrent/lib/torrent.js**: 36.06% (Lines) - **js/webtorrent/lib/webconn.js**: 18.95% (Lines) - **js/webtorrent/node_modules/@thaunknown/simple-peer/lite.js**: 5.64% (Lines) - **js/webtorrent/node_modules/@thaunknown/simple-websocket/index.js**: 21.6% (Lines) - **js/webtorrent/node_modules/@thaunknown/thirty-two/lib/thirty-two/index.js**: 64.46% (Lines) - **js/webtorrent/node_modules/addr-to-ip-port/index.js**: 46.66% (Lines) - **js/webtorrent/node_modules/bencode/lib/util.js**: 65% (Lines) - **js/webtorrent/node_modules/bep53-range/index.js**: 53.57% (Lines) - **js/webtorrent/node_modules/bitfield/lib/esm/index.js**: 47.05% (Lines) - **js/webtorrent/node_modules/bittorrent-protocol/index.js**: 26.33% (Lines) - **js/webtorrent/node_modules/bittorrent-tracker/client.js**: 34.58% (Lines) - **js/webtorrent/node_modules/bittorrent-tracker/lib/client/tracker.js**: 32.14% (Lines) - **js/webtorrent/node_modules/bittorrent-tracker/lib/client/websocket-tracker.js**: 13.12% (Lines) - **js/webtorrent/node_modules/block-iterator/index.js**: 42.22% (Lines) - **js/webtorrent/node_modules/cache-chunk-store/index.js**: 16.66% (Lines) - **js/webtorrent/node_modules/chunk-store-iterator/index.js**: 36.23% (Lines) - **js/webtorrent/node_modules/debug/src/common.js**: 67.8% (Lines) - **js/webtorrent/node_modules/end-of-stream/index.js**: 15.95% (Lines) - **js/webtorrent/node_modules/err-code/index.js**: 34.78% (Lines) - **js/webtorrent/node_modules/escape-html/index.js**: 41.02% (Lines) - **js/webtorrent/node_modules/events/events.js**: 27.72% (Lines) - **js/webtorrent/node_modules/fast-fifo/fixed-size.js**: 33.33% (Lines) - **js/webtorrent/node_modules/fast-fifo/index.js**: 31.25% (Lines) - **js/webtorrent/node_modules/fast-readable-async-iterator/index.js**: 20.58% (Lines) - **js/webtorrent/node_modules/fsa-chunk-store/createWritable.js**: 17.28% (Lines) - **js/webtorrent/node_modules/fsa-chunk-store/index.js**: 4.33% (Lines) - **js/webtorrent/node_modules/immediate-chunk-store/index.js**: 50.9% (Lines) - **js/webtorrent/node_modules/inherits/inherits_browser.js**: 59.25% (Lines) - **js/webtorrent/node_modules/limiter/lib/clock.js**: 23.07% (Lines) - **js/webtorrent/node_modules/limiter/lib/rateLimiter.js**: 39.41% (Lines) - **js/webtorrent/node_modules/limiter/lib/tokenBucket.js**: 41.31% (Lines) - **js/webtorrent/node_modules/lru/index.js**: 18.62% (Lines) - **js/webtorrent/node_modules/lt_donthave/index.js**: 10.44% (Lines) - **js/webtorrent/node_modules/magnet-uri/index.js**: 39.2% (Lines) - **js/webtorrent/node_modules/memory-chunk-store/index.js**: 44.61% (Lines) - **js/webtorrent/node_modules/once/once.js**: 28.57% (Lines) - **js/webtorrent/node_modules/parse-torrent/index.js**: 68.18% (Lines) - **js/webtorrent/node_modules/path-esm/lib/dirname.js**: 11.53% (Lines) - **js/webtorrent/node_modules/path-esm/lib/util.js**: 59.72% (Lines) - **js/webtorrent/node_modules/pump/index.js**: 37.2% (Lines) - **js/webtorrent/node_modules/queue-microtask/index.js**: 55.55% (Lines) - **js/webtorrent/node_modules/random-iterate/index.js**: 52.63% (Lines) - **js/webtorrent/node_modules/range-parser/index.js**: 51.85% (Lines) - **js/webtorrent/node_modules/rc4/rc4.js**: 26.96% (Lines) - **js/webtorrent/node_modules/run-parallel-limit/index.js**: 7.14% (Lines) - **js/webtorrent/node_modules/speed-limiter/lib/throttle-group.js**: 68.13% (Lines) - **js/webtorrent/node_modules/speed-limiter/lib/throttle.js**: 32.86% (Lines) - **js/webtorrent/node_modules/speed-limiter/lib/utils.js**: 57.14% (Lines) - **js/webtorrent/node_modules/streamx/index.js**: 29.74% (Lines) - **js/webtorrent/node_modules/text-decoder/index.js**: 60.93% (Lines) - **js/webtorrent/node_modules/text-decoder/lib/browser-decoder.js**: 52.94% (Lines) - **js/webtorrent/node_modules/throughput/index.js**: 48.57% (Lines) - **js/webtorrent/node_modules/torrent-discovery/index.js**: 49.1% (Lines) - **js/webtorrent/node_modules/torrent-piece/index.js**: 29.9% (Lines) - **js/webtorrent/node_modules/unordered-array-remove/index.js**: 16.66% (Lines) - **js/webtorrent/node_modules/ut_metadata/index.js**: 5.69% (Lines) - **js/webtorrent/node_modules/wrappy/wrappy.js**: 54.54% (Lines) - **scripts/run-unit-tests.mjs**: 65.36% (Lines) - **scripts/agent/setup-test-env.js**: 47.61% (Lines) ## Recommendations 1. Fix suspicious tests (especially timeouts and console usage). 2. Improve coverage for files < 70%. 3. Investigate potential flakiness (if checked).