Labels / Complexity: tests,infrastructure · High — 21## Problem
The repository has no test infrastructure and no CI. package.json defines no test script (only dev, build, start, lint, type-check, storybook, and build-storybook), a search for *.test.* and *.spec.* files returns nothing, and .github/workflows does not exist. The only verification a contributor can run is npm run type-check and npm run lint.
- Pure logic is unguarded: the amount and asset formatting in
lib/stellar/formatting.ts, address validation in lib/stellar/validation.ts, error mapping in lib/stellar/errorHandler.ts, the cache in lib/cache/cacheManager.ts, the stores under store/, and the image utilities in utils/imageUpload.ts have zero regression protection.
- PRs cannot be judged on evidence: reviewers and the funding program have no test output to distinguish a working change from a breaking one.
- Behavioral fixes regress silently: the issues in this milestone (JWT verification, draft storage, share stats, admin auth) each require tests to be considered done, and none can be written today.
Why this is architecturally hard
- The runner choice matters: the repo already depends on Storybook 8 and
@storybook/test, and the test setup must coexist with the existing storybook scripts rather than fight them.
- Component tests need a jsdom environment and React Testing Library, while the repo has no testing dependencies at all; the test stack must be added without disturbing the Next.js 14 build.
- Zustand stores need a test store setup, and
lib/api/interceptors.ts attaches axios interceptors to a shared client, so any store or interceptor test needs a mocked transport that does not leak state between cases.
- The CI workflow must run type-check, lint, build, and test with no secrets and no network beyond package installation, so the pipeline is reproducible for external contributors.
Proposed design
Introduce a runner (vitest or jest, decided in the PR with rationale), add a test script, write unit tests for the pure-logic modules above, and add a GitHub Actions workflow that gates on type-check, lint, build, and test.
Acceptance criteria
npm test exists and runs green in a fresh clone with only npm install.
- Unit tests cover
lib/stellar/formatting.ts, lib/stellar/validation.ts, lib/stellar/errorHandler.ts, lib/cache/cacheManager.ts, store/authStore.ts, store/uiStore.ts, and utils/imageUpload.ts.
- A GitHub Actions workflow under
.github/workflows/ runs type-check, lint, build, and test on push and pull request, with no required secrets.
- The workflow is the only gate; test failures block the run.
- README documents how to run the tests.
Out of scope
End-to-end browser tests and snapshot tests for every component; the unit-test foundation and CI gates are the deliverable.
Getting started
- Read
package.json, tsconfig.json, .eslintrc.json, and the modules listed above.
- Verify the current state with
npm run type-check and npm run lint.
- Pattern-match the pure functions in
lib/stellar/formatting.ts (e.g. toStroops, fromStroops, truncateAddress) as the first natural candidates for tests.
Good first files to read: package.json, lib/stellar/formatting.ts, lib/cache/cacheManager.ts, store/uiStore.ts.
Labels / Complexity:
tests,infrastructure· High — 21## ProblemThe repository has no test infrastructure and no CI.
package.jsondefines notestscript (onlydev,build,start,lint,type-check,storybook, andbuild-storybook), a search for*.test.*and*.spec.*files returns nothing, and.github/workflowsdoes not exist. The only verification a contributor can run isnpm run type-checkandnpm run lint.lib/stellar/formatting.ts, address validation inlib/stellar/validation.ts, error mapping inlib/stellar/errorHandler.ts, the cache inlib/cache/cacheManager.ts, the stores understore/, and the image utilities inutils/imageUpload.tshave zero regression protection.Why this is architecturally hard
@storybook/test, and the test setup must coexist with the existingstorybookscripts rather than fight them.lib/api/interceptors.tsattaches axios interceptors to a shared client, so any store or interceptor test needs a mocked transport that does not leak state between cases.Proposed design
Introduce a runner (vitest or jest, decided in the PR with rationale), add a
testscript, write unit tests for the pure-logic modules above, and add a GitHub Actions workflow that gates on type-check, lint, build, and test.Acceptance criteria
npm testexists and runs green in a fresh clone with onlynpm install.lib/stellar/formatting.ts,lib/stellar/validation.ts,lib/stellar/errorHandler.ts,lib/cache/cacheManager.ts,store/authStore.ts,store/uiStore.ts, andutils/imageUpload.ts..github/workflows/runs type-check, lint, build, and test on push and pull request, with no required secrets.Out of scope
End-to-end browser tests and snapshot tests for every component; the unit-test foundation and CI gates are the deliverable.
Getting started
package.json,tsconfig.json,.eslintrc.json, and the modules listed above.npm run type-checkandnpm run lint.lib/stellar/formatting.ts(e.g.toStroops,fromStroops,truncateAddress) as the first natural candidates for tests.Good first files to read:
package.json,lib/stellar/formatting.ts,lib/cache/cacheManager.ts,store/uiStore.ts.