Jules was unable to complete the task in time. Please review the work…#1
Open
AliAshour2 wants to merge 2 commits intomainfrom
Open
Jules was unable to complete the task in time. Please review the work…#1AliAshour2 wants to merge 2 commits intomainfrom
AliAshour2 wants to merge 2 commits intomainfrom
Conversation
… done so far and provide feedback for Jules to continue.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… done so far and provide feedback for Jules to continue.