Files
galaxy-game/ui/frontend/tests/helpers/empty-ship-groups.ts
T
Ilia Denisov 9e9977d5f1
Tests · Go / test (push) Successful in 2m29s
Tests · UI / test (push) Waiting to run
Tests · Go / test (pull_request) Successful in 2m17s
Tests · Integration / integration (pull_request) Successful in 1m53s
Tests · UI / test (pull_request) Successful in 3m37s
feat(game): race exit warnings in the turn report (#12)
Surface the inactivity-removal countdown the rules promise but the
engine never reported. A race within five turns of being auto-removed
for inactivity gets a personal warning in its own report; every race
within three turns is listed publicly to all participants.

- model: Report.PersonalExitWarning + RacesLeavingSoon ([]RaceExitNotice)
- fbs: RaceExitNotice table + Report.personal_exit_warning /
  races_leaving_soon (regenerated Go + TS bindings)
- transcoder: encode/decode both fields
- engine: ReportExitWarnings fills the recipient's TTL (1..5) and lists
  other non-extinct races with TTL 1..3, excluding the recipient itself
- ui: danger-styled personal banner + "races leaving soon" section
  (hidden when empty), wired into the report view, EN/RU i18n
- docs: rules.txt report-section list, FUNCTIONAL.md 6.4 + RU mirror

Voluntary quit and idle timeout share the TTL countdown and are not
distinguished, per the agreed scope.
2026-05-31 10:34:50 +02:00

69 lines
1.9 KiB
TypeScript

// EMPTY_SHIP_GROUPS supplies empty arrays / zero defaults for the
// ancillary report fields added in Phase 19 (ship-groups + fleets),
// Phase 21 (sciences), Phase 22 (races / diplomacy / voting),
// Phase 23 (full player roster, foreign sciences, foreign ship
// classes, battle ids, bombings, ships in production), and the
// per-turn inactivity exit warnings (personal countdown + public
// races-leaving-soon list).
// Test fixtures spread it into their report objects so the fixture
// body still focuses on the fields under test, without forcing
// every spec to enumerate the full GameReport surface.
import type {
ReportBattle,
ReportBombing,
ReportIncomingShipGroup,
ReportLocalFleet,
ReportLocalShipGroup,
ReportOtherRace,
ReportOtherScience,
ReportOtherShipClass,
ReportOtherShipGroup,
ReportPlayer,
ReportShipProduction,
ReportUnidentifiedShipGroup,
ScienceSummary,
} from "../../src/api/game-state";
export const EMPTY_SHIP_GROUPS: {
localShipGroups: ReportLocalShipGroup[];
otherShipGroups: ReportOtherShipGroup[];
incomingShipGroups: ReportIncomingShipGroup[];
unidentifiedShipGroups: ReportUnidentifiedShipGroup[];
localFleets: ReportLocalFleet[];
otherRaces: string[];
localScience: ScienceSummary[];
races: ReportOtherRace[];
myVotes: number;
myVoteFor: string;
players: ReportPlayer[];
otherScience: ReportOtherScience[];
otherShipClass: ReportOtherShipClass[];
battles: ReportBattle[];
battleIds: string[];
bombings: ReportBombing[];
shipProductions: ReportShipProduction[];
personalExitWarning: number;
racesLeavingSoon: { race: string; turnsLeft: number }[];
} = {
localShipGroups: [],
otherShipGroups: [],
incomingShipGroups: [],
unidentifiedShipGroups: [],
localFleets: [],
otherRaces: [],
localScience: [],
races: [],
myVotes: 0,
myVoteFor: "",
players: [],
otherScience: [],
otherShipClass: [],
battles: [],
battleIds: [],
bombings: [],
shipProductions: [],
personalExitWarning: 0,
racesLeavingSoon: [],
};