Skip to content

Conversation

@AliAshour2
Copy link
Owner

… done so far and provide feedback for Jules to continue.

… done so far and provide feedback for Jules to continue.
@vercel
Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
atc-01033610538 ❌ Failed (Inspect) Jul 16, 2025 10:48am

This commit introduces extensive unit testing for core API slices and addresses several issues to improve robustness and maintainability.

Key changes include:

1.  **Auth API (`authApi.ts`)**:
    *   Added comprehensive Vitest unit tests for all mutations and queries (register, login, logout, forgotPassword, resetPassword, verifyEmail, updateProfile, getAuthState).
    *   Ensured consistent population of the `avatar` field in the User object returned by the login mutation.
    *   Clarified policy: email verification is not enforced at login.

2.  **Event API (`eventApi.ts`)**:
    *   Added comprehensive Vitest unit tests for all event-related operations.
    *   Thoroughly tested the complex filtering logic in the `getEvents` query (category, tags with 10+ limit, date ranges, client-side search).
    *   Tested data transformation, default value assignments, and CRUD operations (getEvent, getEventsByOrganizer, createEvent, updateEvent, deleteEvent).

3.  **Booking API (`bookingApi.ts`)**:
    *   Added comprehensive Vitest unit tests for all booking operations.
    *   Tested query fallback logic in `getUserBookings` for missing Firestore indexes.
    *   Ensured consistent date handling: Firestore Timestamps (`bookedAt`, `checkedInAt`, `eventDate`) are converted to ISO strings when returned to the client.
    *   Updated the `Booking` interface and `CreateBookingDto` for clarity and consistency (e.g., `quantity` to `ticketsBooked`, added `eventName`, `paymentDetails`).
    *   Mutations now correctly handle conversions between ISO strings and Timestamps.

4.  **Testing Environment**:
    *   Established a robust testing setup using Vitest and MSW (though MSW setup was pre-existing, its usage with Firebase mocks was solidified).
    *   Created extensive mocks for Firebase Authentication and Firestore services in `src/test/mocks/firebaseMocks.ts`.
    *   Configured test stores for RTK Query endpoint testing.

5.  **Code Cleanup**:
    *   Removed debug `console.log` statements from API files (`eventApi.ts`, `bookingApi.ts`).

These changes significantly increase test coverage for critical application logic, making the codebase more reliable and easier to maintain.
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.

2 participants