Skip to content

nsc-events-fullstack_32_162_loginWindow#167

Open
NahomAlemu wants to merge 1 commit intomainfrom
chore-162-log-window
Open

nsc-events-fullstack_32_162_loginWindow#167
NahomAlemu wants to merge 1 commit intomainfrom
chore-162-log-window

Conversation

@NahomAlemu
Copy link
Copy Markdown
Contributor

@NahomAlemu NahomAlemu commented Feb 28, 2026

Summary & Changes 📃

  • Resolves: Issue: Add Unit Tests for LoginWindow Component #162

  • Summary: Add comprehensive unit tests for the LoginWindow authentication component

    • 🔨 Addresses missing test coverage for critical authentication functionality including JWT parsing,
      credential validation, and role-based routing
    • 👀 All 53 tests pass with 98.63% line coverage and 100% function coverage
    • 🗨️ Tests mock next/navigation, next/image, localStorage, and fetch API; environment variable
      NSC_EVENTS_PUBLIC_API_URL added to jest.setup.js for module-level initialization
  • Changes:

    • ✅ Added tests/unit/LoginWindow.test.tsx with 53 test cases across 10 categories
    • ✅ Tests cover: form state management, JWT token parsing, role-based navigation (admin/creator/user),
      error handling, localStorage persistence, accessibility, and edge cases
    • ✅ Added NSC_EVENTS_PUBLIC_API_URL to jest.setup.js for components that read env vars at module load
      time
    • 🛠️ No breaking changes
    • 📝 Coverage: 98.63% statements, 94.44% branches, 100% functions

Screenshots / Visual Aids 🔎

Expand ⬇️ 2

How to Test 🧪

  1. Steps to Reproduce:
    • Step 1: Navigate to nsc-events-nextjs/
    • Step 2: Run npm run test -- --coverage LoginWindow.test.tsx
  2. Expected Behavior: All 53 tests pass with coverage metrics displayed
  3. Actual Behavior (if bug): N/A - New test file

Checklist ✅

  • I have tested this PR locally and it works as expected.
  • This PR resolves an issue (Resolves #issue-number).
  • Reviewers, assignees(self), tags, and labels are correctly assigned.
  • Squash commits and enable auto-merge if approved.

@NahomAlemu NahomAlemu self-assigned this Feb 28, 2026
@NahomAlemu NahomAlemu added the unit-test Small-scope logic validation label Feb 28, 2026
@github-actions
Copy link
Copy Markdown

🚀 E2E Smoke Test Results

Running smoke tests only (non-critical files changed)

Status Count
✅ Passed 5
❌ Failed 0
📊 Total 5

View detailed report

💡 To run full E2E suite, add [e2e-full] to your commit message or trigger manually.

@NahomAlemu NahomAlemu changed the title nsc-events-fullstack_32_163_loginWindow nsc-events-fullstack_32_162_loginWindow Feb 28, 2026
@NahomAlemu NahomAlemu linked an issue Mar 7, 2026 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unit-test Small-scope logic validation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Add Unit Tests for LoginWindow Component

1 participant