mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-17 13:53:57 -07:00
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
binaries/data/mods/public/simulation/components/tests
Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
32 lines
1 KiB
JavaScript
32 lines
1 KiB
JavaScript
Engine.LoadComponentScript("interfaces/EndGameManager.js");
|
|
Engine.LoadComponentScript("EndGameManager.js");
|
|
|
|
const cmpEndGameManager = ConstructComponent(SYSTEM_ENTITY, "EndGameManager");
|
|
|
|
const playerEnt1 = 1;
|
|
const wonderDuration = 2 * 60 * 1000;
|
|
|
|
AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
|
|
"GetNumPlayers": () => 4
|
|
});
|
|
|
|
AddMock(SYSTEM_ENTITY, IID_GuiInterface, {
|
|
"DeleteTimeNotification": () => null,
|
|
"AddTimeNotification": () => 1
|
|
});
|
|
|
|
AddMock(playerEnt1, IID_Player, {
|
|
"GetName": () => "Player 1",
|
|
"IsActive": () => true,
|
|
});
|
|
|
|
TS_ASSERT_EQUALS(cmpEndGameManager.skipAlliedVictoryCheck, true);
|
|
cmpEndGameManager.SetAlliedVictory(true);
|
|
TS_ASSERT_EQUALS(cmpEndGameManager.GetAlliedVictory(), true);
|
|
cmpEndGameManager.SetGameSettings({
|
|
"victoryConditions": ["wonder"],
|
|
"wonderDuration": wonderDuration
|
|
});
|
|
TS_ASSERT_EQUALS(cmpEndGameManager.skipAlliedVictoryCheck, false);
|
|
TS_ASSERT_UNEVAL_EQUALS(cmpEndGameManager.GetVictoryConditions(), ["wonder"]);
|
|
TS_ASSERT_EQUALS(cmpEndGameManager.GetGameSettings().wonderDuration, wonderDuration);
|