Differential D179 Diff 987 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_VisionSharing.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_VisionSharing.js
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5]]); | TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5]]); | ||||
TS_ASSERT_EQUALS(cmpVisionSharing.spyId, 20); | TS_ASSERT_EQUALS(cmpVisionSharing.spyId, 20); | ||||
AddMock(14, IID_TechnologyManager, { | AddMock(14, IID_TechnologyManager, { | ||||
"CanProduce": entity => entity == "special/spy", | "CanProduce": entity => entity == "special/spy", | ||||
"ApplyModificationsTemplate": (valueName, curValue, template) => curValue | "ApplyModificationsTemplate": (valueName, curValue, template) => curValue | ||||
}); | }); | ||||
AddMock(14, IID_Player, { | AddMock(14, IID_Player, { | ||||
"GetSpyCostMultiplier": () => 1, | |||||
"TrySubtractResources": costs => false | "TrySubtractResources": costs => false | ||||
}); | }); | ||||
cmpVisionSharing.AddSpy(4, 25); | cmpVisionSharing.AddSpy(4, 25); | ||||
TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.shared], [1, 2, 5]); | TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.shared], [1, 2, 5]); | ||||
TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5]]); | TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5]]); | ||||
TS_ASSERT_EQUALS(cmpVisionSharing.spyId, 20); | TS_ASSERT_EQUALS(cmpVisionSharing.spyId, 20); | ||||
AddMock(14, IID_Player, { | AddMock(14, IID_Player, { | ||||
"GetSpyCostMultiplier": () => 1, | |||||
"TrySubtractResources": costs => true | "TrySubtractResources": costs => true | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_Timer, { | AddMock(SYSTEM_ENTITY, IID_Timer, { | ||||
"SetTimeout": (ent, iid, funcname, time, data) => TS_ASSERT_EQUALS(time, 25 * 1000) | "SetTimeout": (ent, iid, funcname, time, data) => TS_ASSERT_EQUALS(time, 25 * 1000) | ||||
}); | }); | ||||
cmpVisionSharing.AddSpy(4, 25); | cmpVisionSharing.AddSpy(4, 25); | ||||
TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.shared], [1, 2, 5, 4]); | TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.shared], [1, 2, 5, 4]); | ||||
TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5], [21, 4]]); | TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5], [21, 4]]); | ||||
Show All 28 Lines |
Wildfire Games · Phabricator