256ff0814e
Build & Deploy / Build & Push Docker Image (push) Failing after 44s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m0s
Test / Marketplace Unit Tests (push) Failing after 4m51s
Test / Admin Unit Tests (push) Successful in 9m31s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
- Remove apps/marketplace entirely - Create apps/homepage (port 3000): landing/marketing pages (home, features, pricing, platform-ops, review, legal) - Create apps/storefront (port 3004): vehicle browsing (explore) and renter account (dashboard, profile, notifications) - Duplicate shared components/libs into each app - Update homepage header nav: Home, Features, Pricing instead of Home, Explore - Fix all /explore cross-references in homepage to point to /features - Update docker-compose.dev.yml: new homepage and storefront services, remove marketplace - Update docker-compose.production.yml: split into homepage (main domain) and storefront (path-based routes) - Update Dockerfiles: EXPOSE 3004 instead of 3003 - Update root package.json scripts: homepage/storefront profiles, tests, prod scripts - Add docker-prod-up-homepage.sh and docker-prod-up-storefront.sh, remove marketplace script
30 lines
1.5 KiB
TypeScript
30 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { calculateBookingTotalDays, normalizeOptionalText, resolveReturnLocation } from './BookingForm'
|
|
|
|
describe('BookingForm helpers', () => {
|
|
it('calculates booking nights from date-only inputs', () => {
|
|
expect(calculateBookingTotalDays('2026-06-09', '2026-06-10')).toBe(1)
|
|
expect(calculateBookingTotalDays('2026-06-09', '2026-06-16')).toBe(7)
|
|
})
|
|
|
|
it('never returns a negative total for reversed or incomplete dates', () => {
|
|
expect(calculateBookingTotalDays('2026-06-16', '2026-06-09')).toBe(0)
|
|
expect(calculateBookingTotalDays('', '2026-06-09')).toBe(0)
|
|
expect(calculateBookingTotalDays('2026-06-09', '')).toBe(0)
|
|
})
|
|
|
|
it('uses pickup location for same-location returns', () => {
|
|
expect(resolveReturnLocation({ dropoffMode: 'same', pickupLocation: 'Marrakesh Airport', returnLocation: 'Casablanca' })).toBe('Marrakesh Airport')
|
|
})
|
|
|
|
it('uses the explicit return location for different dropoffs and preserves an unset optional value', () => {
|
|
expect(resolveReturnLocation({ dropoffMode: 'different', pickupLocation: 'Marrakesh', returnLocation: 'Casablanca' })).toBe('Casablanca')
|
|
expect(resolveReturnLocation({ dropoffMode: 'different', pickupLocation: 'Marrakesh', returnLocation: '' })).toBeUndefined()
|
|
})
|
|
|
|
it('normalizes optional free-text fields without leaking empty strings into payloads', () => {
|
|
expect(normalizeOptionalText(' flight lands at 9 ')).toBe('flight lands at 9')
|
|
expect(normalizeOptionalText(' ')).toBeUndefined()
|
|
})
|
|
})
|