Repository navigation
test(backend): add unit tests for admin audit, notification, streams, and alert services - #358
Merged
EmeditWeb merged 1 commit intoOct 19, 2026
Conversation
|
@pixels26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds focused unit-test suites for four backend services that had no corresponding test file under
backend/src/services/__tests__/. Each suite covers the service's exported functions and the failure paths that previously could only be caught by integration tests or production.adminAudit.service.ts(#192)verifyChain(): empty table, all-legacy rows, valid multi-link chains, chained rows following legacy rows, tamperedprevHash, tampered row data, first-broken-id reporting, andfindManyrejection.list(): cursor look-ahead trimming,nextCursorboundaries, malformed cursor rejection without a DB call, cursor-mode DB failures, legacy offset pagination, invalid page/limit normalization, limit capping/flooring, and legacycount()failures.adminNotification.service.ts(#193)onSuccess/onFailure, listener error propagation, and no-listener behavior.removeAllListeners()restoring defaults while dropping custom listeners.extractErrorInfo(): error-like objects,Errorinstances, non-string codes, non-object details, non-string messages, and primitive/null/undefined inputs.adminStreams.service.ts(#194)vestingStateOf(): not started, blank amounts, partial/full/over vesting, zerototalVested, arbitrary-precision BigInt comparison, and invalid integer strings.list(): summary mapping, status/adminTag/combined filters, in-memoryvestingStatefiltering, empty and out-of-range pages, pagination flooring/capping/defaults, and DB failures.getByStreamId(): found, missing, and DB failure paths.alert.service.ts(#195)isConfigured(), unconfigured dispatch, signed/unsigned payloads, default details, registry routing/runbook metadata, and timestamps.resetCooldown()for one/all types.Related Issues
src/services/adminAudit.service.ts#192src/services/adminNotification.service.ts#193src/services/adminStreams.service.ts#194src/services/alert.service.ts#195Type of Change
Test Plan
pnpm jest src/services/__tests__/adminAudit.service.test.ts src/services/__tests__/adminNotification.service.test.ts src/services/__tests__/adminStreams.service.test.ts src/services/__tests__/alert.service.test.ts --coverage=false --runInBand-> 4 suites, 70 tests passed.src/__tests__suites for the same services -> 8 suites, 105 tests passed.pnpm eslinton all four new files passes.pnpm test: the new tests pass, but the repository-wide run requires local Postgres/Redis and currently hits pre-existing unrelated failures onmain(e.g.src/services/__tests__/health.service.test.tstype errors and DB connection failures in webhook tests).PR Checklist
pnpm test/cargo test)backend/src/__tests__/was preserved; new service-level suites complement it.