fix(ci): resolve freighter-api CJS crash, BigInt bug, and invalid test fixtures#206
Merged
Conversation
…and invalid test fixtures - Mock ../stellar/walletKit.js in contrato.test.js, ConectarWallet.test.jsx, and accessibility.test.jsx so tests no longer transitively load the real @stellar/freighter-api CJS module via stellar-wallets-kit, which crashed with a named-export SyntaxError under Vitest's ESM resolution. - Rewrite ConectarWallet.test.jsx to match the current wallet-kit-based component API (getConnectedAddress/openWalletModal) instead of stale Freighter-only mocks and a "Freighter" button that no longer exists. - Fix metaTags.js BigInt/Number mixing TypeError by converting proyecto.meta/aportado to BigInt before arithmetic; update metaTags.test.js expectations and add a regression test for missing meta/aportado fields. - Replace invalid checksum fixtures in stellar.test.js with real, valid Stellar G-address/C-address pairs so esDireccionValida/esContractIdValido tests actually exercise valid-address acceptance.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…specs - walletKit.js: move CONFIG.NETWORK read inside initializeKit() so it evaluates lazily, after the contrato.js↔walletKit.js circular import resolves. Previously this crashed with ReferenceError at module load time in every real browser context (production-breaking, invisible in unit tests because walletKit is always mocked there). - e2e/fixtures/freighter.ts: mockFreighterConnected now seeds localStorage.lastWallet='freighter' so walletKit.getConnectedAddress() doesn't early-return null. mockFreighterDisconnected clears it. The underlying postMessage protocol mock was already correct. - e2e/landing.spec.ts: replace stale "Freighter button" locator with a hero-scoped button check; scope the navbar "Conectar" locator to nav[aria-label] to avoid strict-mode violations from 3 matching buttons. - e2e/golden-path.spec.ts: same locator fixes as landing.spec.ts. Result: all 25 E2E tests (8 landing + 10 golden-path + 7 filtros) pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfnhH2CghRyxav22rfM8bQ
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
walletKit.js— production-breaking circular-import TDZ fix:CONFIG.NETWORKwas read at module top-level, before thecontrato.js ↔ walletKit.jscircular import could resolve, causingReferenceError: Cannot access 'CONFIG' before initializationin every real browser context. Moved the read insideinitializeKit()so it evaluates lazily. Previously invisible in unit tests (walletKit is always mocked there); surfaced when running Playwright against the live dev server.walletKit.jsincontrato.test.js,ConectarWallet.test.jsx, andaccessibility.test.jsxto stop transitively loading@stellar/freighter-apiCJS (which crashed under Vitest's ESM resolver). RewroteConectarWallet.test.jsxto match the wallet-kit-based component API.metaTags.jsBigInt fix: convertproyecto.meta/aportadotoBigIntbefore arithmetic to avoidTypeError: Cannot mix BigInt and other types.stellar.test.jsfixtures: replace invalid-checksum test addresses with real valid G/C-address pairs.landing.spec.tsandgolden-path.spec.ts(removed "Freighter" button references; scoped the navbar "Conectar" locator to avoid strict-mode violations from 3 matching buttons). Fixfreighter.tsfixture to seedlocalStorage.lastWallet='freighter'sowalletKit.getConnectedAddress()actually attempts reconnection instead of early-returning null.Result
All 25 E2E tests pass locally (8 landing + 10 golden-path + 7 filtros). All 124 Vitest unit tests pass.
Test plan