Skip to content

Commit 23ca9d6

Browse files
committed
Test for AI creating buildings in the Space biome.
GitOrigin-RevId: 9127cdda47284a167cc504daef87da52918f39d4
1 parent 5c08298 commit 23ca9d6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/__tests__/AIBehavior.test.tsx

+51
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
ShipyardConstructionSite,
2626
} from '@deities/athena/info/Tile.tsx';
2727
import {
28+
APU,
2829
Artillery,
2930
Battleship,
3031
Corvette,
@@ -1185,3 +1186,53 @@ test('activates skills where the unit ratio does not matter', async () => {
11851186
EndTurn { current: { funds: 300, player: 2 }, next: { funds: 0, player: 1 }, round: 2, rotatePlayers: null, supply: null, miss: null }"
11861187
`);
11871188
});
1189+
1190+
test('creates production buildings in the space biome despite not having access to funds buildings', async () => {
1191+
const initialMap = MapData.createMap({
1192+
config: {
1193+
biome: 4,
1194+
},
1195+
map: [
1196+
1, 1, 1, 29, 29, 1, 1, 1, 29, 29, 1, 1, 1, 29, 1, 1, 1, 1, 29, 29, 1, 1,
1197+
1, 1, 8,
1198+
],
1199+
size: {
1200+
height: 5,
1201+
width: 5,
1202+
},
1203+
teams: [
1204+
{
1205+
id: 1,
1206+
name: '',
1207+
players: [{ funds: 0, id: 1, userId: 'User-1' }],
1208+
},
1209+
{
1210+
id: 2,
1211+
name: '',
1212+
players: [{ funds: 1000, id: 2, name: 'AI' }],
1213+
},
1214+
],
1215+
});
1216+
1217+
const map = initialMap.copy({
1218+
units: initialMap.units
1219+
.set(vec(1, 1), APU.create(1))
1220+
.set(vec(3, 5), Pioneer.create(2))
1221+
.set(vec(5, 3), Infantry.create(2)),
1222+
});
1223+
1224+
const [, , gameStateA] = await executeGameAction(
1225+
map,
1226+
map.createVisionObject(player1),
1227+
new Map(),
1228+
EndTurnAction(),
1229+
AIRegistry,
1230+
);
1231+
1232+
expect(snapshotGameState(gameStateA)).toMatchInlineSnapshot(`
1233+
"Move (3,5 → 5,5) { fuel: 38, completed: null, path: [4,5 → 5,5] }
1234+
CreateBuilding (5,5) { building: Spawn Platform { id: 19, health: 100, player: 2, completed: true }, free: null }
1235+
CompleteUnit (5,3)
1236+
EndTurn { current: { funds: 850, player: 2 }, next: { funds: 0, player: 1 }, round: 2, rotatePlayers: null, supply: null, miss: null }"
1237+
`);
1238+
});

0 commit comments

Comments
 (0)