Updated tests/core/game/RailNetwork.test.ts station mock to include onStationRemoved, matching the production API.

Expanded tests/core/game/TrainStation.test.ts mocks: added game.x/y, ensured trainExecution.shareJourneyInfo() returns the expected structure, and gave the otherUnit mock a tile() for parity with real units.
This commit is contained in:
scamiv
2025-11-18 21:32:20 +01:00
parent 1528a91154
commit ba77ca9468
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@ const createMockStation = (unitId: number): any => {
addRailroad: jest.fn(),
getRailroads: jest.fn(() => railroads),
clearRailroads: jest.fn(),
onStationRemoved: jest.fn(),
};
};
+4
View File
@@ -21,6 +21,8 @@ describe("TrainStation", () => {
}),
addUpdate: jest.fn(),
addExecution: jest.fn(),
x: jest.fn((tile) => tile?.x ?? 0),
y: jest.fn((tile) => tile?.y ?? 0),
} as any;
player = {
@@ -42,6 +44,7 @@ describe("TrainStation", () => {
loadCargo: jest.fn(),
owner: jest.fn().mockReturnValue(player),
level: jest.fn(),
shareJourneyInfo: jest.fn().mockReturnValue({ routeInformation: [] }),
} as any;
});
@@ -71,6 +74,7 @@ describe("TrainStation", () => {
it("checks trade availability (same owner)", () => {
const otherUnit = {
owner: jest.fn().mockReturnValue(unit.owner()),
tile: jest.fn().mockReturnValue({ x: 0, y: 0 }),
} as any;
const station = new TrainStation(game, unit);