1
0
Fork 0

Fixed loading/saving unit testing not being stable (due to stored timestamp in AI)

This commit is contained in:
Michaël Lemaire 2015-03-05 01:00:00 +01:00
parent 96d91e6b3d
commit cf2f585109
5 changed files with 15 additions and 1 deletions

View file

@ -71,6 +71,7 @@ downloads = .
packages =
phaser-official#2.2.2
jasmine#2.1.3
deep-diff#0.3.0
[mkdir-var]
recipe = z3c.recipe.mkdir

View file

@ -5,6 +5,7 @@ module.exports = function (config) {
frameworks: ['jasmine'],
files: [
'src/vendor/phaser-official/build/phaser.js',
'src/vendor/deep-diff/releases/deep-diff-0.3.0.min.js',
'build/main.js'
],
client: {

View file

@ -15,6 +15,7 @@
<!-- build:remove -->
<script src="http://localhost:35729/livereload.js"></script>
<script src="vendor/deep-diff/releases/deep-diff-0.3.0.min.js"></script>
<!-- /build -->
<!-- build:js all.min.js -->

View file

@ -18,7 +18,7 @@ module SpaceTac.Game.AI {
async: boolean;
// Time at which work as started
private started: number;
started: number;
// Queue of work items to process
// Work items will be called successively, leaving time for other processing between them.

View file

@ -25,6 +25,17 @@ module SpaceTac.Game.Specs {
applyGameSteps(universe);
applyGameSteps(loaded_universe);
// Clean stored times as they might differ
var clean = (u: Universe) => {
u.battle.fleets.forEach((fleet: Fleet) => {
if (fleet.player.ai) {
fleet.player.ai.started = 0;
}
});
};
clean(universe);
clean(loaded_universe);
// Check equality after game steps
expect(loaded_universe).toEqual(universe);
});