import { content } from "@deadhead/content"; import type { PlayerState, Ship } from "@deadhead/schema"; import { effectiveStats } from "@deadhead/sim"; // Plain data builders shared by component tests and the Playwright tests (no Vitest imports). /** * The CR-009 fields of a ship with no upgrades and not in the shop: its model's * stats as effective stats. Spread into Ship fixtures, then override as needed. */ export function shipExtras( modelId: string, upgrades: Record = {}, ): Pick { const model = content.shipModel(modelId); if (!model) throw new Error(`Unknown ship model ${modelId}`); const s = effectiveStats(model, upgrades, content); return { upgrades, stats: { cruiseSpeedKmPerGameHour: s.cruiseSpeedKmPerGameHour, cargoCapacityTonnes: s.cargoCapacityTonnes, tankCapacityFu: s.tankCapacityFu, burnFuPerMillionKm: s.burnFuPerMillionKm, overheadGameHours: s.overheadGameHours, handlingGameHoursPerTonne: s.handlingGameHoursPerTonne, }, inShopUntil: null, shop: null, }; } /** A brand-new tutorial player, as guest sign-up returns it. */ export function samplePlayerState(overrides: Partial = {}): PlayerState { return { playerId: "player-1", company: { id: "co1", name: "Deadhead Freight", credits: 0, loanBalance: 0 }, ships: [], pilots: [ { id: "avatar", name: "Captain", isAvatar: true, isVeteran: false, xp: 0, level: 0, skills: {}, skillPointsAvailable: 0, assignedShipId: null, status: "idle", locationId: "earth", dutyHours: 0, dutyLimit: 12, resting: false, restEndsAt: null, }, ], bays: [], locations: [ { id: "earth", discovered: true }, { id: "moon", discovered: true }, { id: "mars", discovered: false }, { id: "ceres-station", discovered: false }, { id: "jupiter-cloud-platform", discovered: false }, ], tutorial: { loanerLocationId: "earth", runInFlight: false, runsCompleted: 0, dealAvailable: false, }, activeDispatches: [], summaries: [], goals: [], ...overrides, }; }