mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Test import/export of module state and priority.
This commit is contained in:
@@ -97,7 +97,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
|||||||
this.bulkheads.c = null;
|
this.bulkheads.c = null;
|
||||||
this.useBulkhead(comps && comps.bulkheads ? comps.bulkheads : 0, true);
|
this.useBulkhead(comps && comps.bulkheads ? comps.bulkheads : 0, true);
|
||||||
this.cargoScoop.priority = priorities ? priorities[0] * 1 : 0;
|
this.cargoScoop.priority = priorities ? priorities[0] * 1 : 0;
|
||||||
this.cargoScoop.enabled = enabled ? Boolean(enabled[0]) : true;
|
this.cargoScoop.enabled = enabled ? enabled[0] * true : true;
|
||||||
|
|
||||||
for (i = 0, l = this.priorityBands.length; i < l; i++) {
|
for (i = 0, l = this.priorityBands.length; i < l; i++) {
|
||||||
this.priorityBands[i].deployed = 0;
|
this.priorityBands[i].deployed = 0;
|
||||||
@@ -111,7 +111,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
|||||||
|
|
||||||
for (i = 0; i < cl; i++) {
|
for (i = 0; i < cl; i++) {
|
||||||
common[i].cat = 0;
|
common[i].cat = 0;
|
||||||
common[i].enabled = enabled ? Boolean(enabled[i + 1]) : true;
|
common[i].enabled = enabled ? enabled[i + 1] * true : true;
|
||||||
common[i].priority = priorities ? priorities[i + 1] * 1 : 0;
|
common[i].priority = priorities ? priorities[i + 1] * 1 : 0;
|
||||||
common[i].type = 'SYS';
|
common[i].type = 'SYS';
|
||||||
common[i].c = common[i].id = null; // Resetting 'old' component if there was one
|
common[i].c = common[i].id = null; // Resetting 'old' component if there was one
|
||||||
@@ -128,7 +128,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
|||||||
|
|
||||||
for (i = 0, l = hps.length; i < l; i++) {
|
for (i = 0, l = hps.length; i < l; i++) {
|
||||||
hps[i].cat = 1;
|
hps[i].cat = 1;
|
||||||
hps[i].enabled = enabled ? Boolean(enabled[cl + i]) : true;
|
hps[i].enabled = enabled ? enabled[cl + i] * true : true;
|
||||||
hps[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
hps[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
||||||
hps[i].type = hps[i].maxClass ? 'WEP' : 'SYS';
|
hps[i].type = hps[i].maxClass ? 'WEP' : 'SYS';
|
||||||
hps[i].c = hps[i].id = null; // Resetting 'old' component if there was one
|
hps[i].c = hps[i].id = null; // Resetting 'old' component if there was one
|
||||||
@@ -143,7 +143,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
|||||||
|
|
||||||
for (i = 0, l = internal.length; i < l; i++) {
|
for (i = 0, l = internal.length; i < l; i++) {
|
||||||
internal[i].cat = 2;
|
internal[i].cat = 2;
|
||||||
internal[i].enabled = enabled ? Boolean(enabled[cl + i]) : true;
|
internal[i].enabled = enabled ? enabled[cl + i] * true : true;
|
||||||
internal[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
internal[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
||||||
internal[i].type = 'SYS';
|
internal[i].type = 'SYS';
|
||||||
internal[i].id = internal[i].c = null; // Resetting 'old' component if there was one
|
internal[i].id = internal[i].c = null; // Resetting 'old' component if there was one
|
||||||
|
|||||||
36
test/fixtures/anaconda-test-detailed-export.json
vendored
36
test/fixtures/anaconda-test-detailed-export.json
vendored
@@ -5,8 +5,8 @@
|
|||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"name": "Coriolis.io",
|
"name": "Coriolis.io",
|
||||||
"url": "http://localhost:3300/outfit/anaconda/48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b?bn=Test",
|
"url": "http://localhost:3300/outfit/anaconda/48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b.Iw18QDBNA%3D%3D%3D.AwhMJBGaei%2BJCyyiA%3D%3D%3D?bn=Test",
|
||||||
"code": "48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b",
|
"code": "48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b.Iw18QDBNA===.AwhMJBGaei+JCyyiA===",
|
||||||
"shipId": "anaconda"
|
"shipId": "anaconda"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"class": 6,
|
"class": 6,
|
||||||
"rating": "A",
|
"rating": "A",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1
|
"priority": 3
|
||||||
},
|
},
|
||||||
"lifeSupport": {
|
"lifeSupport": {
|
||||||
"class": 5,
|
"class": 5,
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
"class": 4,
|
"class": 4,
|
||||||
"rating": "A",
|
"rating": "A",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Plasma Accelerator",
|
"group": "Plasma Accelerator",
|
||||||
"mount": "Fixed"
|
"mount": "Fixed"
|
||||||
},
|
},
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"class": 3,
|
"class": 3,
|
||||||
"rating": "D",
|
"rating": "D",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Beam Laser",
|
"group": "Beam Laser",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"class": 3,
|
"class": 3,
|
||||||
"rating": "D",
|
"rating": "D",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Beam Laser",
|
"group": "Beam Laser",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
"class": 3,
|
"class": 3,
|
||||||
"rating": "D",
|
"rating": "D",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Beam Laser",
|
"group": "Beam Laser",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
"class": 2,
|
"class": 2,
|
||||||
"rating": "E",
|
"rating": "E",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Cannon",
|
"group": "Cannon",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
"class": 2,
|
"class": 2,
|
||||||
"rating": "E",
|
"rating": "E",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Cannon",
|
"group": "Cannon",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
"class": 1,
|
"class": 1,
|
||||||
"rating": "F",
|
"rating": "F",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Beam Laser",
|
"group": "Beam Laser",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
},
|
},
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
"class": 1,
|
"class": 1,
|
||||||
"rating": "F",
|
"rating": "F",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Beam Laser",
|
"group": "Beam Laser",
|
||||||
"mount": "Turret"
|
"mount": "Turret"
|
||||||
}
|
}
|
||||||
@@ -142,20 +142,20 @@
|
|||||||
"class": 0,
|
"class": 0,
|
||||||
"rating": "C",
|
"rating": "C",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Kill Warrant Scanner"
|
"group": "Kill Warrant Scanner"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"class": 0,
|
"class": 0,
|
||||||
"rating": "C",
|
"rating": "C",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Cargo Scanner"
|
"group": "Cargo Scanner"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"class": 0,
|
"class": 0,
|
||||||
"rating": "F",
|
"rating": "F",
|
||||||
"enabled": true,
|
"enabled": false,
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"group": "Countermeasure",
|
"group": "Countermeasure",
|
||||||
"name": "Electronic Countermeasure"
|
"name": "Electronic Countermeasure"
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
"class": 0,
|
"class": 0,
|
||||||
"rating": "I",
|
"rating": "I",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 2,
|
||||||
"group": "Countermeasure",
|
"group": "Countermeasure",
|
||||||
"name": "Point Defence"
|
"name": "Point Defence"
|
||||||
}
|
}
|
||||||
@@ -233,14 +233,14 @@
|
|||||||
"class": 4,
|
"class": 4,
|
||||||
"rating": "A",
|
"rating": "A",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 3,
|
||||||
"group": "Fuel Scoop"
|
"group": "Fuel Scoop"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"class": 2,
|
"class": 2,
|
||||||
"rating": "A",
|
"rating": "A",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"priority": 1,
|
"priority": 3,
|
||||||
"group": "FSD Interdictor"
|
"group": "FSD Interdictor"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
"totalDps": 29,
|
"totalDps": 29,
|
||||||
"powerAvailable": 36,
|
"powerAvailable": 36,
|
||||||
"powerRetracted": 23.93,
|
"powerRetracted": 23.93,
|
||||||
"powerDeployed": 35.56,
|
"powerDeployed": 35.36,
|
||||||
"unladenRange": 18.49,
|
"unladenRange": 18.49,
|
||||||
"fullTankRange": 18.12,
|
"fullTankRange": 18.12,
|
||||||
"ladenRange": 16.39,
|
"ladenRange": 16.39,
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ describe('Import Controller', function() {
|
|||||||
expect(scope.processed).toBeTruthy();
|
expect(scope.processed).toBeTruthy();
|
||||||
scope.import();
|
scope.import();
|
||||||
expect(angular.fromJson(localStorage.getItem('builds'))).toEqual({
|
expect(angular.fromJson(localStorage.getItem('builds'))).toEqual({
|
||||||
anaconda: { 'Test': '48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b.Iw18ZlA=.Aw18ZlA=' }
|
anaconda: { 'Test': '48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b.Iw18QDBNA===.AwhMJBGaei+JCyyiA===' }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ describe("Serializer Service", function() {
|
|||||||
|
|
||||||
var Ship,
|
var Ship,
|
||||||
Serializer,
|
Serializer,
|
||||||
code = '48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b',
|
code = '48A6A6A5A8A8A5C2c0o0o0o1m1m0q0q0404-0l0b0100034k5n052d04--0303326b.Iw18QDBNA===.AwhMJBGaei+JCyyiA===',
|
||||||
anaconda = DB.ships['anaconda'],
|
anaconda = DB.ships['anaconda'],
|
||||||
testBuild,
|
testBuild,
|
||||||
exportData;
|
exportData;
|
||||||
@@ -21,13 +21,20 @@ describe("Serializer Service", function() {
|
|||||||
exportData = Serializer.toDetailedBuild('Test', testBuild, code);
|
exportData = Serializer.toDetailedBuild('Test', testBuild, code);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("conforms to the ship-loadout schema", function() {
|
it("conforms to the v1 ship-loadout schema", function() {
|
||||||
var shipLoadoutSchema = __json__['schemas/ship-loadout/1'];
|
var shipLoadoutSchema = __json__['schemas/ship-loadout/1'];
|
||||||
var validate = jsen(shipLoadoutSchema);
|
var validate = jsen(shipLoadoutSchema);
|
||||||
var valid = validate(exportData);
|
var valid = validate(exportData);
|
||||||
expect(valid).toBeTruthy();
|
expect(valid).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("conforms to the v2 ship-loadout schema", function() {
|
||||||
|
var shipLoadoutSchema = __json__['schemas/ship-loadout/2'];
|
||||||
|
var validate = jsen(shipLoadoutSchema);
|
||||||
|
var valid = validate(exportData);
|
||||||
|
expect(valid).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
it("contains the correct components and stats", function() {
|
it("contains the correct components and stats", function() {
|
||||||
var anacondaTestExport = __json__['fixtures/anaconda-test-detailed-export'];
|
var anacondaTestExport = __json__['fixtures/anaconda-test-detailed-export'];
|
||||||
expect(exportData.components).toEqual(anacondaTestExport.components);
|
expect(exportData.components).toEqual(anacondaTestExport.components);
|
||||||
|
|||||||
Reference in New Issue
Block a user