Test Suite

38 tests covering core business logic — runs entirely in the browser

38 total

Generates TLB-XXXX-XXXX format

Each reference is unique (100 samples)

Does not contain ambiguous characters (0, O, 1, I)

Returns zeros when no config provided

Calculates correct base price for 4 nights at £40/night

Adds cleaning fee to total

Extra guest charge (2nd adult onwards)

Pet fee (flat per booking)

Children price per night

Returns 0 for same-day check-in/check-out

Fixed-price extra

Per-night extra

Per-person extra

Extra with quantity > 1

Extras with quantity 0 are skipped

Seasonal override replaces base price

Weekend price applies on Saturdays and Sundays

Seasonal price takes precedence over weekend price

isRangeAvailable: all dates available

isRangeAvailable: blocked date in range returns false

isRangeAvailable: booked date in range returns false

isRangeAvailable: check-out date itself is excluded

getDateRangeStatuses: generates correct date list

planHasFeature: Free cannot access analytics

planHasFeature: Plus can access analytics

planHasFeature: Free cannot access team features

planHasFeature: Professional can access team features

planHasFeature: unknown key returns true (no restriction)

getPlan: returns correct plan data

getPlan: unknown plan defaults to Free

PLANS: 4 plans defined

aggregateAnalytics: sums all metric fields

aggregateAnalytics: handles empty array

aggregateAnalytics: handles missing fields gracefully

computeFinancialSummary: sums paid invoices

computeFinancialSummary: sums completed booking revenue

computeFinancialSummary: sums ad campaign spend

computeFinancialSummary: overdue invoices count as outstanding

Note: These tests cover pure functions and deterministic logic in bookingService.js and businessService.js — no network calls, no auth required. For full integration testing (entity CRUD, booking flows, auth), use the Base44 Testing Agent (test-tube icon in the side panel).