Differential D1305 Diff 5824 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_StatisticsTracker.js
Engine.LoadComponentScript("StatisticsTracker.js"); | |||||
Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); | |||||
Engine.LoadComponentScript("interfaces/Timer.js"); | |||||
AddMock(SYSTEM_ENTITY, IID_Timer, { | |||||
"SetInterval": () => true | |||||
}); | |||||
Resources = { | |||||
"GetCodes": () => ["food", "metal", "stone", "wood"] | |||||
}; | |||||
let cmpStatisticsTracker = ConstructComponent(SYSTEM_ENTITY, "StatisticsTracker"); | |||||
let obj1 = { | |||||
"successfulBribes": 3, | |||||
"unitsTrained": { | |||||
"Infantry": 5, | |||||
"Worker": 7 | |||||
} | |||||
}; | |||||
let obj2 = { | |||||
"successfulBribes": [11, 13, 17], | |||||
"unitsTrained": { | |||||
"Infantry": [19, 23], | |||||
"Worker": 29 | |||||
} | |||||
}; | |||||
cmpStatisticsTracker.PushValue(obj1, obj2); | |||||
TS_ASSERT_UNEVAL_EQUALS(obj2, { | |||||
"successfulBribes": [11, 13, 17, 3], | |||||
"unitsTrained": { | |||||
"Infantry": [19, 23, 5], | |||||
"Worker": [7] | |||||
} | |||||
}); |
Wildfire Games · Phabricator