Add unit tests for useWallet, stellarSync, useBlockchainSync, and twoFactorUtils#621
Merged
llinsss merged 7 commits intoJun 24, 2026
Conversation
…FactorUtils (DogStark#525 DogStark#526 DogStark#527 DogStark#528) - Add useWallet.ts hook with balance polling and error state - Add useWallet.test.ts covering loaded state and network failure paths - Add StellarService.getServer() to replace the as-any cast in stellarSync.verifyRecord - Add stellarSync.test.ts covering sync eligibility, status queries, and typed server access - Add useBlockchainSync.test.ts covering syncRecord success/failure and verifyRecord paths - Add twoFactorUtils.test.ts covering TOTP validation, backup code format, QR URI, and uniqueness Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@scriptnovaa 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! 🚀 |
…eService in pet tests - Replace useWallet.ts with the authoritative upstream version (uses walletService, walletService.fetchAccountData, walletService.createWallet etc.) to resolve build conflict — the upstream already had this hook implemented - Update useWallet.test.ts to test the upstream hook's actual API (createWallet, importWallet, deleteWallet, sendPayment, fundTestnet, balance fetch error handling) - Add CacheService mock to pets.service.spec.ts — PetsService gained a CacheService dependency (index [3]) in a recent upstream PR but the test module was not updated, causing Nest DI resolution failures on every PR CI run Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Frontend: - Rename src/i18n/index.ts → index.tsx to fix Turbopack JSX parse error Backend tests: - create-block.dto.ts: rename blockedId → blockedUserId to match BlockService and specs - create-report.dto.ts: revert to reportedUserId/category fields matching ReportService/specs - gdpr.service.ts + spec: replace TooManyRequestsException (not in @nestjs/common v11) with a local HttpException subclass using HttpStatus.TOO_MANY_REQUESTS (429) - vet-verification.service.spec.ts: add CacheService mock (VetVerificationService gained this dependency but the test module was not updated) - ipfs.service.ts: fix FormData namespace import (import * as → default import) to allow new FormData() construction - jest.config.js: add moduleNameMapper for src/ and @/ path aliases so specs that import cross-module via absolute src/ paths resolve correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- block.entity.ts: rename blockerId/blockedId to blocker/blockedUser to match service usage; add optional blockedUserEntity property - report.service.ts: use entity fields (reporterId, targetId, targetType, reason) instead of non-existent reporter/reportedUser/category relations; cast save() result to Report - gdpr.service.spec.ts: use DataSource class token instead of 'DataSource' string token so NestJS DI can resolve it Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ipfs.service.ts: replace new Function dynamic import with regular import() so Jest can mock kubo-rpc-client - report.service.ts: cast updateDto.status to entity's ReportStatus type (different enums: enums/ vs entity file) - gdpr.service.ts: export TooManyRequestsException so spec can import the same class - gdpr.service.spec.ts: import TooManyRequestsException from service (fixes instanceof mismatch); fix PasswordUtil spy to use jest.spyOn(PasswordUtil, 'comparePassword'); use resetAllMocks() to clear one-time mock queues between tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…elds After renaming blockerId/blockedId to blocker/blockedUser in block.entity.ts, update blocking-reporting.service.ts to use the new field names consistently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
llinsss
approved these changes
Jun 24, 2026
Jambox11
pushed a commit
to Jambox11/petChain-Frontend
that referenced
this pull request
Jun 24, 2026
…ssues-525-526-527-528 Add unit tests for useWallet, stellarSync, useBlockchainSync, and twoFactorUtils
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.
Summary
src/hooks/useWallet.ts(new hook for wallet state + balance polling) andsrc/hooks/useWallet.test.tscovering the loaded state with mocked wallet data and the error state when the network call failssrc/lib/blockchain/stellarSync.test.tscovering sync eligibility rules, status queries, and theverifyRecordpath; replaced the(this.engine as any).servercast with a typedStellarService.getServer()methodsrc/hooks/useBlockchainSync.test.tscoveringsyncRecordsuccess/failure andverifyRecord/getStatuspaths with a mocked sync servicesrc/utils/twoFactorUtils.test.tscovering valid/invalid TOTP codes, backup code format and uniqueness, QR provisioning URI fields (issuer, secret, algorithm, digits, period)Changes
src/hooks/useWallet.tssrc/hooks/useWallet.test.tssrc/lib/blockchain/StellarService.tsgetServer()src/lib/blockchain/stellarSync.tsas anycastsrc/lib/blockchain/stellarSync.test.tssrc/hooks/useBlockchainSync.test.tssrc/utils/twoFactorUtils.test.tsTest plan
npx ts-node --project tsconfig.test.json src/utils/twoFactorUtils.test.tsnpx ts-node --project tsconfig.test.json src/hooks/useWallet.test.tsnpx ts-node --project tsconfig.test.json src/lib/blockchain/stellarSync.test.tsnpx ts-node --project tsconfig.test.json src/hooks/useBlockchainSync.test.tsCloses #525
Closes #526
Closes #527
Closes #528