Skip to content

test: add unit tests for auth form validation (#121)#138

Merged
zacharias-ona merged 1 commit into
mainfrom
feat/121-auth-form-validation-tests
Apr 16, 2026
Merged

test: add unit tests for auth form validation (#121)#138
zacharias-ona merged 1 commit into
mainfrom
feat/121-auth-form-validation-tests

Conversation

@zacharias-ona
Copy link
Copy Markdown
Collaborator

Closes #121

What

Adds unit tests for the sign-in and sign-up form components, covering validation attributes, error display, Supabase auth method calls, and post-auth redirect logic.

How

  • src/app/(auth)/sign-up/page.test.tsx — 9 tests covering:

    • Form field rendering and validation attributes (required, type=email, minLength=6)
    • Display name required validation
    • Error message display on sign-up failure
    • supabase.auth.signUp called with correct email, password, and display_name
    • Redirect to workspace slug after successful sign-up
    • Fallback redirect to / when no workspace found
    • Submit button disabled during loading
  • src/app/(auth)/sign-in/page.test.tsx — 8 tests covering:

    • Form field rendering and validation attributes (required, type=email, minLength=6)
    • Error message display on sign-in failure
    • supabase.auth.signInWithPassword called with correct email and password
    • Redirect to workspace slug after successful sign-in
    • Fallback redirect to / when no workspace found
    • Submit button disabled during loading

Both test files mock @/lib/supabase/client, next/navigation, next/link, and @/components/auth/oauth-buttons following the established pattern from workspace-settings-form.test.tsx.

Testing

  • pnpm lint — ✅ pass
  • pnpm typecheck — ✅ pass
  • pnpm test — ✅ 122 tests pass (16 files), including 17 new tests

Co-authored-by: Ona <no-reply@ona.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
memo Ready Ready Preview, Comment Apr 16, 2026 11:36pm

Request Review

@zacharias-ona zacharias-ona merged commit 0196fd9 into main Apr 16, 2026
6 checks passed
@zacharias-ona zacharias-ona deleted the feat/121-auth-form-validation-tests branch April 16, 2026 23:39
@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ Post-merge verification skipped — test: PR does not affect the live app.

@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ UI verification skipped — this PR contains only test files (page.test.tsx), no UI changes to verify against the design spec.

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.

test: add unit tests for auth form validation

1 participant