Skip to content

test: add Vitest suite, required Tests check and testing strategy - #665

Merged
daithihearn merged 5 commits into
mainfrom
test/kit-test-strategy
Oct 15, 2026
Merged

daithihearn merged 5 commits into
mainfrom
test/kit-test-strategy

Conversation

@daithi-dev-vm

@daithi-dev-vm daithi-dev-vm Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds a test runner, a unit suite and a VeWorld end-to-end suite to the kit, which had no running tests, with the strategy in docs/testing.md.

Vitest 4 with happy-dom runs three projects under yarn test: the kit, the lambda tests (moved from Jest, same assertions) and the CI gate script. 151 tests cover the smart-account authorization path (EIP-712 builders, useBuildClauses, PrivyWalletProvider.sendTransaction and useGenericDelegator against a fake Thor node and fake delegators), gas math, VIP-191 assembly, provider config mapping to Privy and dapp-kit, a full mount with the real DAppKitProvider, dependency-tree identity (the valtio crash) and the built bundle. Coverage floors apply to four hot-spot files.

yarn test:e2e runs 9 Playwright tests against the built next-template on a Docker thor-solo: VeWorld login, logout, reload, rejected connection, transactions with toast and modal confirmed on chain, rejected signature, message and typed-data signing. VeWorld is a window.vechain v2 shim that signs in Node with a solo key; the example gains an opt-out mode without a Privy app id.

The Tests workflow has two jobs to require, Tests and E2E. Both skip in-job only when every changed file is docs or assets, failing closed, always run on main and need no secrets.

Removed: the skipped Playwright suite and its workflow, and the lambda-only workflow. No kit runtime changes; six bugs noticed while testing are listed in the doc. happy-dom replaces jsdom, which cannot start on the pinned Node 20.18.

Vitest 4 with happy-dom at the repo root runs the kit, lambda and CI gate
script. 151 tests cover the smart-account authorization path, generic
delegator gas and VIP-191 assembly, provider config mapping to Privy and
dapp-kit, a real DAppKitProvider mount, dependency-tree identity and the
built bundle. The Tests workflow is a single required check that skips
in-job only for docs and assets. The skipped Playwright suite and the
lambda-only workflow are removed; strategy and follow-ups in docs/testing.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d7e85fc-5f14-4775-ad41-13445a0f9aad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The kit never imports valtio; only dapp-kit and dapp-kit-react must share
a copy. react, react-dom and react-query keep the kit as anchor.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@daithi-dev-vm

daithi-dev-vm Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Before/after: main vs #663 (chore/privy-react-auth-v3)

Method. The suite at 190f622 was run on this branch (based on main, react-auth 2.25.0) and on a local, unpushed merge of this branch into origin/chore/privy-react-auth-v3 (react-auth 3.48.0; #663's lockfile plus a yarn install to add the test toolchain). Node 20.18.3 from .nvmrc, yarn kit:build && yarn test:coverage.

main + this PR #663 + this PR
yarn kit:typecheck pass pass
yarn kit:build pass pass
Tests 151 / 151 pass 149 pass, 2 fail
Suite duration 6.5 s 6.4 s

The two failures on #663 (deliberate, one cause)

  • VeChainKitProvider.config.test.tsx › places createOnLogin where the installed Privy version reads it
  • VeChainKitProvider.config.test.tsx › falls back to VeChain's Privy app and a theme-derived accent colour without a privy prop

Both assert the embeddedWallets shape the kit hands to PrivyProvider. On main the kit sets { createOnLogin } (already deprecated in 2.25.0); #663 moves it to { ethereum: { createOnLogin } } because react-auth 3 ignores the top-level key. When #663 rebases on this PR, the two expectations become { ethereum: { createOnLogin: 'users-without-wallets' } } and { ethereum: { createOnLogin: 'all-users' } }. That is the whole diff; it is the test doing its job on the misconfiguration that was previously silent.

What stays green on #663

  • The smart-account signing path: EIP-712 builders, useBuildClauses, PrivyWalletProvider.sendTransaction, useGenericDelegator (fake Thor node + fake delegators), VIP-191 assembly.
  • The Privy surface the kit imports (PrivyProvider, usePrivy, useLoginWithEmail/OAuth/Passkey, useCreateWallet, useMfaEnrollment, useSetWalletRecovery) still type-checks against 3.48.0.
  • Full provider mount with the real DAppKitProvider, wagmi and cross-app-connect; the built-bundle smoke test; the dependency identity test.

The valtio crash is now guarded

With #663's root valtio@1.13.2 devDependency removed from the merged tree and yarn install re-run, Yarn hoists valtio 2.1.7 to the root and nests 1.13.2 under @vechain/dapp-kit and @vechain/dapp-kit-react separately. Three tests then fail:

  • moduleIdentity.test.ts › resolves a single copy of 'valtio' across dapp-kit, dapp-kit-react (names the two paths);
  • VeChainKitProvider.mount.test.tsx with TypeError: Cannot read properties of undefined (reading '3'), the error quoted in chore(deps): upgrade @privy-io/react-auth to 3.48.0 #663;
  • distSmoke.test.tsx › mounts VeChainKitProvider from the bundle.

Note for #663: it also leaves a nested valtio 2.1.7 under packages/vechain-kit/node_modules for @reown/appkit*. The kit never imports valtio and both dapp-kit packages share the root 1.13.2, so that is harmless; the identity test anchors on the dapp-kit pair for this reason.

Coverage totals are only emitted on a fully passing run, so there are none for the #663 run.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: +64 B (0%)

Total Size: 9.36 MB

Filename Size Change
packages/vechain-kit/dist/index-BmZpdzZn.d.mts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-BmZpdzZn.d.mts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-CcyjRtDa.d.cts 0 B -200 kB (removed) 🏆
packages/vechain-kit/dist/index-CcyjRtDa.d.cts.map 0 B -56.3 kB (removed) 🏆
packages/vechain-kit/dist/index-DszTG8BN.d.mts 0 B -200 kB (removed) 🏆
packages/vechain-kit/dist/index-DszTG8BN.d.mts.map 0 B -55.1 kB (removed) 🏆
packages/vechain-kit/dist/index-DVPTcJRO.d.cts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-DVPTcJRO.d.cts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-BH7jqfB8.d.mts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-BH7jqfB8.d.mts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-DBNvCJ5-.d.cts 200 kB +200 kB (new file) 🆕
packages/vechain-kit/dist/index-DBNvCJ5-.d.cts.map 56.3 kB +56.3 kB (new file) 🆕
packages/vechain-kit/dist/index-DIreuylM.d.mts 200 kB +200 kB (new file) 🆕
packages/vechain-kit/dist/index-DIreuylM.d.mts.map 55.1 kB +55.1 kB (new file) 🆕
packages/vechain-kit/dist/index-DLHd0j4S.d.cts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-DLHd0j4S.d.cts.map 2.99 kB +2.99 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
packages/vechain-kit/dist/assets 4.1 kB
packages/vechain-kit/dist/assets-BpQtJMK4.mjs 51.4 kB
packages/vechain-kit/dist/assets-BpQtJMK4.mjs.map 74.7 kB
packages/vechain-kit/dist/assets-qmvJ4lSm.cjs 59 kB
packages/vechain-kit/dist/assets-qmvJ4lSm.cjs.map 76.2 kB
packages/vechain-kit/dist/assets/index.cjs 717 B
packages/vechain-kit/dist/assets/index.d.cts 973 B
packages/vechain-kit/dist/assets/index.d.mts 973 B
packages/vechain-kit/dist/assets/index.mjs 719 B
packages/vechain-kit/dist/index.cjs 1.21 MB
packages/vechain-kit/dist/index.cjs.map 3 MB
packages/vechain-kit/dist/index.d.cts 25.3 kB
packages/vechain-kit/dist/index.d.mts 25.3 kB
packages/vechain-kit/dist/index.mjs 1.16 MB
packages/vechain-kit/dist/index.mjs.map 2.94 MB
packages/vechain-kit/dist/utils 4.1 kB
packages/vechain-kit/dist/utils-Bf4wG_2j.cjs 27.4 kB
packages/vechain-kit/dist/utils-Bf4wG_2j.cjs.map 69.8 kB
packages/vechain-kit/dist/utils-Y7vw7K0X.mjs 22.2 kB
packages/vechain-kit/dist/utils-Y7vw7K0X.mjs.map 69 kB
packages/vechain-kit/dist/utils/index.cjs 2.02 kB
packages/vechain-kit/dist/utils/index.d.cts 3.1 kB
packages/vechain-kit/dist/utils/index.d.mts 3.1 kB
packages/vechain-kit/dist/utils/index.mjs 2.04 kB

compressed-size-action

…check

Nine tests drive the built next-template in Chromium: VeWorld login, logout,
reload, rejected connection, transactions with toast and modal confirmed on
chain, rejected signature, message and typed-data signing. VeWorld is a
window.vechain v2 shim that signs in Node with a solo genesis key, since the
published veworld-mock only speaks the v1 Connex API. The example gains an
opt-out mode without a Privy app id and reads the network from the env. The
Tests workflow gets a second job, E2E, with the same change gate.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@daithi-dev-vm

daithi-dev-vm Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

E2E tier added (23b5e2f)

yarn test:e2e drives the built next-template in Chromium against a Docker thor-solo. Local run on Node 20.18.3: 9 / 9 passed in 25 s (solo starts in 11 s, kit + example build in 27 s).

Flow Test
App loads without uncaught errors connect.spec.ts
VeWorld login → wallet button shows the address, connection type and network; logout via Settings clears the session connect.spec.ts
Rejected connection leaves the user logged out connect.spec.ts
Session survives a reload connect.spec.ts
Transaction with toast: VeWorld asked with the right signer and gas, tx mined on solo, receipt not reverted, origin matches transactions.spec.ts
Transaction with modal: "Operation successful", modal closes transactions.spec.ts
Rejected signature: error shown, nothing broadcast, no page errors transactions.spec.ts
Sign message: goes through a thor_signCertificate whose certificate verifies signing.spec.ts
Sign typed data: signature shown is the one the wallet produced signing.spec.ts

How VeWorld is driven. dapp-kit 2.3 uses the v2 window.vechain.request API by default; the published @vechain/veworld-mock only implements the v1 Connex signer. tests/e2e/fixtures/veworld.ts installs a window.vechain shim whose request is a Playwright exposeFunction that signs in Node with a thor-solo genesis key (certificates, typed data, transactions), so every transaction really lands on the chain.

Workflow. tests.yaml now has two jobs, Tests and E2E, both behind the same in-job change gate; make both required. E2E pulls the thor image and installs Chromium, so expect 5–7 minutes; neither job needs secrets.

Two findings from building it (recorded in docs/testing.md, not fixed here):

  • Blocking auth.privy.io leaves every kit app, VeWorld-only included, on its loading spinner: connection.isLoading waits for Privy's ready. The E2E run therefore keeps that one live GET.
  • The wallet button trims to 4+4 characters while humanAddress defaults to 6+4; cosmetic, noted for consistency.

Still manual (tier 2, needs a Privy test app, test-account OTP and a funded testnet key as secrets): social login/logout/link, smart-account transaction end to end, domain names, mnemonic backup. The doc's "Manual checklist coverage" table maps the maintainers' list item by item.

daithihearn and others added 2 commits October 15, 2026 13:06
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@daithihearn
daithihearn merged commit f051ca2 into main Oct 15, 2026
14 checks passed
@daithihearn
daithihearn deleted the test/kit-test-strategy branch October 15, 2026 13:22
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.

1 participant