feat(mobile): connect orders and reservations flow to backend#220
Merged
Conversation
React DoctorScore: |
- Create apps/mobile/src/utils/date.ts with getDatePartsInTimezone and HOURS_PER_DAY named constant - Replace duplicated inline getParts in moments.ts and useTimeValidation.ts with shared utility - Add i18n keys for cascade_timeout_helper, max_attempts_helper, project_timezone_helper - Fix hardcoded English strings in admin project form - Add 27 tests covering timezone edge cases: UTC±0, ±12, ±14, half-hour, quarter-hour offsets, DST spring/fall, leap year, year boundary, and local/UTC date crossing
Replace jest.spyOn(useCartStore.getState(), 'setContext') with direct store state assertions. The spy pattern is unreliable in CI due to Zustand v5 reference handling. Check store state directly after submit instead.
…iness The test relied on jest.useFakeTimers + jest.setSystemTime to prevent isTimeInPast from blocking the submit flow. Since selectedDate is always 2024-01-15 (not today at runtime), isTimeInPast returns false regardless of the real system clock - fake timers were unnecessary. Also added an explicit expect(submitButton.props.accessibilityState?.disabled) toBeFalsy check to verify the button is enabled before pressing.
… GGA violations - Add expired-moment guard in handleProceed before setContext call - Add time_error_expired i18n key (en/es) - Add testID to all interactive components in index.tsx + DatePicker.tsx - Extract magic numbers: EPOCH_TIMESTAMP, MIN_GUEST_COUNT, TIME_PAD_WIDTH - Extract magic numbers in DatePicker: DEFAULT_HOUR, CALENDAR_ICON_SIZE, PENCIL_ICON_SIZE - Add test for expired moment blocking submit flow - Add testID prop to DatePicker component interface - Use named constants over inline literals for GGA compliance
…re updater type - Use functional form for setGuestCount to avoid stale closures (prev -> prev +/- 1) - Add useMemo for getDefaultTimeForMoment to stabilize Date reference across renders - Update cart.store setGuestCount to accept (prev: number) => number updater - Pass functional updater through to Zustand set for consistency
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.
Pull Request Template
Linked Issue
Closes #211
Summary
/v1/ordersand/v1/reservations) with type-safe operations.RestOrderServiceandRestProductService) to use the newapiClienthelper injecting the auth token.connect-mobile-orders-apiandorders-endpoints-booking-flowsessions.Changes
apps/mobile/src/services/api-client.tsapps/mobile/src/services/order.service.tsRestOrderServiceto use client & support Zod DTOsapps/mobile/src/services/product.service.tsRestProductService& threw errors in REST placeOrderapps/mobile/src/app/tourist/booking.tsxopenspec/changes/archive/archive-report.mdTest Summary
✅ PASS: 532 total tests, make check successful
Contributor Checklist
type:*labelmake checkand tests passCo-Authored-Bytrailers