mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 22:31:55 +00:00
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:
@@ -22,6 +22,7 @@ const createMockStation = (unitId: number): any => {
|
||||
addRailroad: jest.fn(),
|
||||
getRailroads: jest.fn(() => railroads),
|
||||
clearRailroads: jest.fn(),
|
||||
onStationRemoved: jest.fn(),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user