Fixed loading/saving unit testing not being stable (due to stored timestamp in AI)
This commit is contained in:
parent
96d91e6b3d
commit
cf2f585109
|
@ -71,6 +71,7 @@ downloads = .
|
||||||
packages =
|
packages =
|
||||||
phaser-official#2.2.2
|
phaser-official#2.2.2
|
||||||
jasmine#2.1.3
|
jasmine#2.1.3
|
||||||
|
deep-diff#0.3.0
|
||||||
|
|
||||||
[mkdir-var]
|
[mkdir-var]
|
||||||
recipe = z3c.recipe.mkdir
|
recipe = z3c.recipe.mkdir
|
||||||
|
|
|
@ -5,6 +5,7 @@ module.exports = function (config) {
|
||||||
frameworks: ['jasmine'],
|
frameworks: ['jasmine'],
|
||||||
files: [
|
files: [
|
||||||
'src/vendor/phaser-official/build/phaser.js',
|
'src/vendor/phaser-official/build/phaser.js',
|
||||||
|
'src/vendor/deep-diff/releases/deep-diff-0.3.0.min.js',
|
||||||
'build/main.js'
|
'build/main.js'
|
||||||
],
|
],
|
||||||
client: {
|
client: {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
<!-- build:remove -->
|
<!-- build:remove -->
|
||||||
<script src="http://localhost:35729/livereload.js"></script>
|
<script src="http://localhost:35729/livereload.js"></script>
|
||||||
|
<script src="vendor/deep-diff/releases/deep-diff-0.3.0.min.js"></script>
|
||||||
<!-- /build -->
|
<!-- /build -->
|
||||||
|
|
||||||
<!-- build:js all.min.js -->
|
<!-- build:js all.min.js -->
|
||||||
|
|
|
@ -18,7 +18,7 @@ module SpaceTac.Game.AI {
|
||||||
async: boolean;
|
async: boolean;
|
||||||
|
|
||||||
// Time at which work as started
|
// Time at which work as started
|
||||||
private started: number;
|
started: number;
|
||||||
|
|
||||||
// Queue of work items to process
|
// Queue of work items to process
|
||||||
// Work items will be called successively, leaving time for other processing between them.
|
// Work items will be called successively, leaving time for other processing between them.
|
||||||
|
|
|
@ -25,6 +25,17 @@ module SpaceTac.Game.Specs {
|
||||||
applyGameSteps(universe);
|
applyGameSteps(universe);
|
||||||
applyGameSteps(loaded_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
|
// Check equality after game steps
|
||||||
expect(loaded_universe).toEqual(universe);
|
expect(loaded_universe).toEqual(universe);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue