Skip to content

test(wallets): focused Wallet integration suite (src/tests/e2e)#1944

Open
albertoelias-crossmint wants to merge 1 commit into
mainfrom
wallets/e2e-integration-tests
Open

test(wallets): focused Wallet integration suite (src/tests/e2e)#1944
albertoelias-crossmint wants to merge 1 commit into
mainfrom
wallets/e2e-integration-tests

Conversation

@albertoelias-crossmint

@albertoelias-crossmint albertoelias-crossmint commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

A small, organized Wallet-orchestration integration suite at packages/wallets/src/tests/e2e/18 tests in 4 by-concern files, covering behavior that emerges from the Wallet wiring services together (mocked ApiClient) and that the colocated unit tests can't reach:

File Tests Concern
wallet.initialization.test.ts 4 initDefaultSigner auto-assembly ladder (0 / 1 / >1 delegated, fail-swallow)
wallet.recovery.test.ts 2 preAuthIfNeeded single-flight recover + ensureAuthenticated ordering
wallet.transactions.test.ts 4 approval payload selection (by API response shape) + onTransactionStart ordering
wallet.factory-rewrap.test.ts 8 from() chain-subclass state carryover

How this was scoped

Distilled from the refactor's local characterization suite (was never committed). Each candidate was checked against existing coverage and dropped if redundant:

  • All server-signer wipe/derivation behavior → already in resolver.test.ts (unit).
  • recover() fallback / mapAddressToKey / AuthRejected / resume → already in wallet.test.ts.
  • useSigner per-type, addSigner/removeSigner, payload shapes → wallet.test.ts / descriptors.test.ts / chain-adapter.test.ts.
  • Stale pins (pre-fix behavior the reliability PRs reversed) → dropped outright.

Result: only genuinely-unique, current-behavior orchestration remains — no duplicate coverage, no resolver internals re-tested through a full Wallet.

Verification

18/18 green; tsc clean; biome error-gate exits 0. Test-only (no src/ logic touched).

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6014171

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
packages/wallets/src/tests/e2e/polling.test.ts:1373-1433
**Hardcoded call-count assertions are tightly coupled to internal constants**

The test pins the exact number of `getTransaction` calls at specific absolute timestamps (e.g., `expect(callsAt31s).toBe(24)` at t=31 s, `callsAt31s + 4` over the next 8 s). Any change to `STATUS_POLLING_INTERVAL_MS` (currently 500 ms), the 1.1× growth factor, the cap value, or the post-approval 1 s sleep will silently invalidate these counts and produce an opaque `Expected: 24, Received: N` failure with no indication of what changed. The math in the test is correct for the current constants, but the assertions don't carry any record of which constants they depend on. Consider embedding the relevant constant values as named variables in the test, or adding a comment block that lists the numbers the assertion depends on so a future failure is immediately diagnosable.

### Issue 2 of 3
packages/wallets/src/tests/e2e/device-init-and-recovery.test.ts:916-924
**`createMockDeviceKeyStorage` is duplicated verbatim across two test files**

An identical copy of `createMockDeviceKeyStorage` appears in both `device-init-and-recovery.test.ts` and `signer-wiring-and-device-usesigner.test.ts`. If the storage interface gains a new required method (or a mock default needs updating), both copies must be changed in sync. Extracting this factory into `test-helpers.ts` — alongside `createMockApiClient` and `createMockWallet` — would keep the two test files aligned automatically.

### Issue 3 of 3
packages/wallets/src/tests/e2e/use-signer-resolution.test.ts:2604
**`isZeroed` guard diverges between files**

`server-signer-hygiene.test.ts` defines `isZeroed` as `buf.length > 0 && buf.every(b => b === 0)`, while this file omits the length guard (`bytes.every(b => b === 0)`). For a zero-length `Uint8Array`, the second variant returns `true` (vacuous truth), so a bug that produces an empty buffer instead of a zeroed 32-byte one would go undetected here. Both files are currently only called with 32-byte buffers so there is no active failure, but the inconsistency is worth aligning.

Reviews (1): Last reviewed commit: "test(wallets): add Wallet-level integrat..." | Re-trigger Greptile

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

A small, organized integration suite for the Wallet orchestration that unit
tests can't cover (mocked ApiClient). 18 tests in 4 by-concern files:
- wallet.initialization: initDefaultSigner auto-assembly ladder
- wallet.recovery: preAuthIfNeeded single-flight + ensureAuthenticated
- wallet.transactions: approval payload selection + onTransactionStart ordering
- wallet.factory-rewrap: from() chain-subclass state carryover

Distilled from the refactor's local characterization suite: only genuinely-unique,
current-behavior orchestration kept; everything covered by colocated unit tests
(resolver/descriptors/operation-poller) or wallet.test.ts was dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@albertoelias-crossmint albertoelias-crossmint force-pushed the wallets/e2e-integration-tests branch from aeec47c to 6014171 Compare June 23, 2026 22:30
@albertoelias-crossmint albertoelias-crossmint changed the title test(wallets): add Wallet-level integration test suite (src/tests/e2e) test(wallets): focused Wallet integration suite (src/tests/e2e) Jun 23, 2026
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "test(wallets): add focused Wallet integr..." | Re-trigger Greptile

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread packages/wallets/src/tests/e2e/wallet.factory-rewrap.test.ts
@albertoelias-crossmint albertoelias-crossmint enabled auto-merge (squash) June 23, 2026 23:01
);
if (useApiKeySigner) {
// biome-ignore lint/suspicious/noExplicitAny: api-key config is valid on every chain
await wallet.useSigner({ type: "api-key" } as any);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these casts?

type: "external-wallet",
address: "0x123",
onSign,
} as unknown as SignerConfigForChain<"base-sepolia">);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, do we need these type of casts?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants