Add component tests for the sign-up and log-in form

Open
#139 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend, testing

Research direction

Start with apps/web/src/components/AuthForm.tsx for the login/register behaviour and apps/web/src/lib/api.ts for the client to mock. Check whether the test setup from #108 is merged before writing anything, since the issue says to ask there if it is not. Done means at least 8 meaningful Vitest and Testing Library tests that pass under npm test and in CI, with no fixed waits.

Written by the indexing model from the issue text.

Description

help wanted tests web

Difficulty: Intermediate · Estimated size: 1 day

Context

apps/web/src/components/AuthForm.tsx handles both log in and register, validation messages and the consent line. It has no unit tests. This depends on the web test setup in #108.

Problem or goal

Cover the form's behaviour with component tests so future changes do not break sign-up.

Suggested approach

  • Use Vitest and Testing Library (set up in #108).
  • Test: required fields, invalid email, short password, the register-only username field, the consent line with working links, the busy state, and that the error from a failed request is shown and announced.
  • Mock the API client, not fetch.

Where to look

  • apps/web/src/components/AuthForm.tsx
  • apps/web/src/lib/api.ts

Acceptance criteria

  • At least 8 meaningful tests, none relying on fixed waits.
  • They run in npm test and in CI.

Hints

If #108 is not merged yet, ask in that issue before starting.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Dominant language
TypeScript
Stars
6
Forks
6
Avg merge
1h 59m
Merged PRs (30d)
59

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Haseeb-MernStack/commune

All issues in Haseeb-MernStack/commune

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.