Skip to content

test: add coverage for property, security, and KYC components (#924, #925, #926, #927) - #970

Merged
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
DanielCharis1:fix/tests-924-927
Aug 29, 2026
Merged

test: add coverage for property, security, and KYC components (#924, #925, #926, #927)#970
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
DanielCharis1:fix/tests-924-927

Conversation

@DanielCharis1

@DanielCharis1 DanielCharis1 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Jest test coverage for the four Stellar Wave issues assigned to @DanielCharis1:

Why cacheManager needed a repair

src/lib/__tests__/cacheManager.test.ts already existed (44 tests from #715) but could not run on main:

  1. __mocks__/viem.js was missing the defineChain export, breaking any suite that transitively imports viem via src/config/chains.ts (e.g. cacheManager, walletStore).
  2. ethers 6.16's sha256 always throws in the jsdom test env: toUtf8Bytes/crypto digest values are Node Buffers, which fail the instanceof Uint8Array check against jsdom's realm — so addToSyncQueue (dedupe hashing) broke. The test file now mocks ethers with deterministic equivalents.
  3. The crypto.randomUUID polyfill in jest.setup.js produced a non-UUID string (15 hex chars), and one sync-queue assertion expected the legacy Date.now()-random id format.

Verification

npx jest src/components/property/__tests__ src/components/security/__tests__ src/components/kyc/__tests__ src/lib/__tests__/cacheManager.test.ts src/store/__tests__/kycStore.test.ts src/store/__tests__/transactionSecurityStore.test.ts
# 114 passed, 114 total

All 41 cacheManager tests, 18 TransactionSecuritySettings tests, and the new property/KYC specs pass via npm test (Jest). Note: npm test on main has other pre-existing failures (e.g. walletStore circular import) unrelated to these issues.

closes #924
closes #925
closes #926
closes #927

…hain#924, MettaChain#925, MettaChain#926, MettaChain#927)

Add Jest specs for DocumentSection and ShareButton (property document
rendering and share flows), TransactionSecuritySettings (security toggle
persistence), and the KYC components (step gating, rejection/retry states,
and audit log rendering).

Also repair the cacheManager test suite so it runs under `npm test`:
- add the missing `defineChain` export to the viem mock, which broke every
  suite that transitively imports viem via chains.ts
- mock ethers' sha256/toUtf8Bytes in cacheManager.test.ts (ethers 6.16
  returns Node Buffers that fail instanceof against the jsdom Uint8Array)
- fix the broken crypto.randomUUID polyfill in jest.setup.js so it emits a
  valid UUID v4, and update a stale sync-queue id assertion

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@DanielCharis1 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! 🚀

Learn more about application limits

@nanaf6203-bit
nanaf6203-bit merged commit 6cba6c8 into MettaChain:main Aug 29, 2026
3 of 5 checks passed
@github-actions

Copy link
Copy Markdown

🔒 Preview Environment Destroyed

The preview environment for this PR has been torn down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants