Skip to content

Repository has no test infrastructure or CI: zero test files, no test script, and no workflow gates #10

Description

@ibrahimmosouf-png

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaigninfrastructureCI, build, and toolingtestsTest coverage and test infrastructure

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions