Skip to content

Conversation

@ekanshgupta2046
Copy link
Contributor

Description

🧪 Added Frontend Test Coverage (Vitest + React Testing Library)

Implemented comprehensive test cases for Navbar, Browse (Product Cards), SignIn, and SignUp components to ensure stable and predictable UI behaviour.

🧭 Navbar Component (5 Tests)
Renders brand name and navigation links correctly.
Highlights active link based on current route.
Toggles between light/dark themes.
Opens and closes the mobile menu (hamburger icon).
Navigates correctly when clicking on “Sign In” and “Sign Up” buttons.

🛒 Browse (Product Cards) (5 Tests)
Renders the page heading and product cards.
Filters products using the search bar.
Opens filter drawer and applies category filters.
Clears filters using the “Clear” button.
Displays alert when “Add to Cart” is clicked.

🔐 SignIn Form (5 Tests)
Renders form fields (email, password) and submit button.
Validates empty field errors.
Displays error for invalid credentials.
Navigates on successful login mock.
Renders link to SignUp page.

📝 SignUp Form (5 Tests)
Renders all input fields and the submit button.
Validates required fields and shows errors.
Checks password confirmation mismatch.
Mocks successful submission flow.
Renders link to SignIn page.

✅ All test suites pass successfully (npm run test) — improving reliability and ensuring key UI flows are covered.

Semver Changes

  • Patch (bug fix, no new features)
  • Minor (new features, no breaking changes)
  • Major (breaking changes)

Issues

closes #24

Checklist

Copy link
Member

@04shubham7 04shubham7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Fine

@04shubham7 04shubham7 merged commit 5cb90d1 into OPCODE-Open-Spring-Fest:main Oct 30, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add unit testing for frontend components

2 participants