mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-19 07:46:26 +00:00
update meta
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { DefaultConfig } from "../src/core/configuration/DefaultConfig";
|
||||
import { createGameConfig } from "./util/Setup";
|
||||
import { TestServerConfig } from "./util/TestServerConfig";
|
||||
|
||||
describe("Config", () => {
|
||||
test("Trade ship spawn rate", async () => {
|
||||
const config = new DefaultConfig(
|
||||
new TestServerConfig(),
|
||||
createGameConfig(),
|
||||
null,
|
||||
false,
|
||||
);
|
||||
|
||||
expect(config.tradeShipSpawnRate(0)).toBe(5);
|
||||
expect(config.tradeShipSpawnRate(1)).toBe(5);
|
||||
expect(config.tradeShipSpawnRate(20)).toBe(5);
|
||||
expect(config.tradeShipSpawnRate(21)).toBe(6);
|
||||
expect(config.tradeShipSpawnRate(30)).toBe(15);
|
||||
expect(config.tradeShipSpawnRate(50)).toBe(35);
|
||||
expect(config.tradeShipSpawnRate(100)).toBe(85);
|
||||
expect(config.tradeShipSpawnRate(151)).toBe(1_000_000);
|
||||
});
|
||||
});
|
||||
+16
-10
@@ -36,7 +36,21 @@ export async function setup(
|
||||
|
||||
// Configure the game
|
||||
const serverConfig = new TestServerConfig();
|
||||
const gameConfig: GameConfig = {
|
||||
|
||||
const config = new TestConfig(
|
||||
serverConfig,
|
||||
createGameConfig(_gameConfig),
|
||||
new UserSettings(),
|
||||
false,
|
||||
);
|
||||
|
||||
return createGame(humans, [], gameMap, miniGameMap, config);
|
||||
}
|
||||
|
||||
export function createGameConfig(
|
||||
gameConfig: Partial<GameConfig> = {},
|
||||
): GameConfig {
|
||||
return {
|
||||
gameMap: GameMapType.Asia,
|
||||
gameMode: GameMode.FFA,
|
||||
gameType: GameType.Singleplayer,
|
||||
@@ -46,16 +60,8 @@ export async function setup(
|
||||
infiniteGold: false,
|
||||
infiniteTroops: false,
|
||||
instantBuild: false,
|
||||
..._gameConfig,
|
||||
...gameConfig,
|
||||
};
|
||||
const config = new TestConfig(
|
||||
serverConfig,
|
||||
gameConfig,
|
||||
new UserSettings(),
|
||||
false,
|
||||
);
|
||||
|
||||
return createGame(humans, [], gameMap, miniGameMap, config);
|
||||
}
|
||||
|
||||
export function playerInfo(name: string, type: PlayerType): PlayerInfo {
|
||||
|
||||
Reference in New Issue
Block a user