Files
OpenFrontIO/tests/Team.test.ts
T
evanpelle b48770faf0 Move maps generation out of repo, new map structure (#1256)
## Description:

Move map generation outside of main repo, it has been rewritten in Go
and is much faster. Also refactor how maps are stored, one dir per map.
The map binaries are basically identical to before. Some maps like
Africa have 1% difference in bytes, but playing it looks exactly the
same.

Use lazy loading for map data access so only needed files are accessed.

Unit tests now load map binary instead of regenerating it from scratch,
speeding them up.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
evan
2025-06-23 11:23:56 -07:00

43 lines
1.1 KiB
TypeScript

import {
ColoredTeams,
Game,
GameMode,
PlayerType,
} from "../src/core/game/Game";
import { playerInfo, setup } from "./util/Setup";
let game: Game;
describe("Teams", () => {
test("bots are on the same team, but can attack each other", async () => {
game = await setup("plains", { gameMode: GameMode.Team, playerTeams: 2 });
const bot1 = game.addPlayer(playerInfo("bot1", PlayerType.Bot));
const bot2 = game.addPlayer(playerInfo("bot2", PlayerType.Bot));
// Both bots should be on the same team
expect(bot1.team()).toBe(ColoredTeams.Bot);
expect(bot2.team()).toBe(ColoredTeams.Bot);
// But they should be allowed to attack each other.
expect(bot1.isOnSameTeam(bot2)).toBe(false);
});
test("humans spawn on different teams", async () => {
game = await setup(
"plains",
{
gameMode: GameMode.Team,
playerTeams: 2,
},
[
playerInfo("human1", PlayerType.Human),
playerInfo("human2", PlayerType.Human),
],
);
expect(game.player("human1").isOnSameTeam(game.player("human2"))).toBe(
false,
);
});
});