Merge branch 'develop'

This commit is contained in:
willyb321
2018-06-20 06:42:20 +10:00
8 changed files with 318 additions and 292 deletions

View File

@@ -1,10 +1,13 @@
module.exports = {
"env": {},
"extends": "eslint:recommended",
"rules": {
"indent": [2, 4],
"linebreak-style": [2, "unix"],
"quotes": [2, "single"],
"semi": [2, "always"]
}
'env': {
'browser': true,
'node': true
},
'extends': 'eslint:recommended',
'rules': {
'indent': ['error', 2],
'linebreak-style': [2, 'unix'],
'quotes': [2, 'single'],
'semi': [2, 'always']
}
};

47
dist/index.js vendored
View File

@@ -101,7 +101,7 @@ module.exports = {
speed: 230,
boost: 330,
boostEnergy: 19,
baseShieldStrength: 154,
baseShieldStrength: 200,
baseArmour: 280,
hardness: 65,
hullMass: 400,
@@ -3728,7 +3728,7 @@ module.exports = {
}, {
class: 2,
cost: 162e3,
edID: 128064037,
edID: 128833988,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -3742,11 +3742,11 @@ module.exports = {
}, {
class: 3,
cost: 291600,
edID: 128064037,
edID: 128833989,
eddbID: 895,
eff: .5,
grp: "pp",
id: "0B",
id: "0T",
integrity: 70,
mass: 2.9,
pgen: 15.8,
@@ -3756,7 +3756,7 @@ module.exports = {
}, {
class: 4,
cost: 524880,
edID: 128064037,
edID: 128833990,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -3770,7 +3770,7 @@ module.exports = {
}, {
class: 5,
cost: 944790,
edID: 128064037,
edID: 128833991,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -3784,7 +3784,7 @@ module.exports = {
}, {
class: 6,
cost: 1700610,
edID: 128064037,
edID: 128833992,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -3798,7 +3798,7 @@ module.exports = {
}, {
class: 7,
cost: 3061100,
edID: 128064037,
edID: 128833993,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -3812,7 +3812,7 @@ module.exports = {
}, {
class: 8,
cost: 5509980,
edID: 128064037,
edID: 128833994,
eddbID: 895,
eff: .5,
grp: "pp",
@@ -11282,6 +11282,28 @@ module.exports = {
name: "Corrosion Resistant",
rating: "F",
symbol: "Int_CorrosionProofCargoRack_Size1_Class2"
}, {
cargo: 4,
class: 2,
cost: 12563,
edID: 128681992,
eddbID: 1552,
grp: "cr",
id: "0V",
name: "Corrosion Resistant",
rating: "F",
symbol: "Int_CorrosionProofCargoRack_Size2_Class1"
}, {
cargo: 16,
class: 4,
cost: 94330,
edID: 128681992,
eddbID: 1552,
grp: "cr",
id: "0W",
name: "Corrosion Resistant",
rating: "E",
symbol: "Int_CorrosionProofCargoRack_Size4_Class1"
} ],
cc: [ {
class: 1,
@@ -21802,7 +21824,7 @@ module.exports = {
integrity: [ .12, .15 ],
mass: [ 3, 3 ],
power: [ .25, .25 ],
shieldboost: [ .372, .456 ]
shieldboost: [ .372, .38 ]
},
uuid: "933e238e-56e0-44d6-b114-49eaab02f033"
}
@@ -22786,7 +22808,6 @@ module.exports = {
features: {
piercing: [ 0, .4 ],
range: [ 0, .36 ],
rof: [ 0, .36 ],
thermload: [ .01, .01 ]
},
uuid: "fc3e4f2e-04fb-4509-a31f-1121940e1bc6"
@@ -22799,7 +22820,6 @@ module.exports = {
features: {
piercing: [ .4, .6 ],
range: [ .36, .52 ],
rof: [ .36, .52 ],
thermload: [ .02, .02 ]
},
uuid: "437e00b1-a6fd-4d84-9242-075c3ce8adcb"
@@ -22813,7 +22833,6 @@ module.exports = {
features: {
piercing: [ .6, .8 ],
range: [ .52, .68 ],
rof: [ .52, .68 ],
thermload: [ .03, .03 ]
},
uuid: "bfbadc34-e11a-4cc4-80cc-83dde5731e6f"
@@ -22827,7 +22846,6 @@ module.exports = {
features: {
piercing: [ .8, 1 ],
range: [ .68, .84 ],
rof: [ .68, .84 ],
thermload: [ .04, .04 ]
},
uuid: "7c41f9fc-90ec-435e-9d92-6024c32ac40d"
@@ -22841,7 +22859,6 @@ module.exports = {
features: {
piercing: [ 1, 1.2 ],
range: [ .84, 1 ],
rof: [ .84, 1 ],
thermload: [ .05, .05 ]
},
uuid: "d9306721-43a4-45cd-b225-ac9174da4d13"

64
dist/index.json vendored
View File

@@ -147,7 +147,7 @@
"speed": 230,
"boost": 330,
"boostEnergy": 19,
"baseShieldStrength": 154,
"baseShieldStrength": 200,
"baseArmour": 280,
"hardness": 65,
"hullMass": 400,
@@ -5648,7 +5648,7 @@
{
"class": 2,
"cost": 162000,
"edID": 128064037,
"edID": 128833988,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -5663,11 +5663,11 @@
{
"class": 3,
"cost": 291600,
"edID": 128064037,
"edID": 128833989,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
"id": "0B",
"id": "0T",
"integrity": 70,
"mass": 2.9,
"pgen": 15.8,
@@ -5678,7 +5678,7 @@
{
"class": 4,
"cost": 524880,
"edID": 128064037,
"edID": 128833990,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -5693,7 +5693,7 @@
{
"class": 5,
"cost": 944790,
"edID": 128064037,
"edID": 128833991,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -5708,7 +5708,7 @@
{
"class": 6,
"cost": 1700610,
"edID": 128064037,
"edID": 128833992,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -5723,7 +5723,7 @@
{
"class": 7,
"cost": 3061100,
"edID": 128064037,
"edID": 128833993,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -5738,7 +5738,7 @@
{
"class": 8,
"cost": 5509980,
"edID": 128064037,
"edID": 128833994,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -13634,6 +13634,30 @@
"name": "Corrosion Resistant",
"rating": "F",
"symbol": "Int_CorrosionProofCargoRack_Size1_Class2"
},
{
"cargo": 4,
"class": 2,
"cost": 12563,
"edID": 128681992,
"eddbID": 1552,
"grp": "cr",
"id": "0V",
"name": "Corrosion Resistant",
"rating": "F",
"symbol": "Int_CorrosionProofCargoRack_Size2_Class1"
},
{
"cargo": 16,
"class": 4,
"cost": 94330,
"edID": 128681992,
"eddbID": 1552,
"grp": "cr",
"id": "0W",
"name": "Corrosion Resistant",
"rating": "E",
"symbol": "Int_CorrosionProofCargoRack_Size4_Class1"
}
],
"cc": [
@@ -28227,7 +28251,7 @@
],
"shieldboost": [
0.372,
0.456
0.38
]
},
"uuid": "933e238e-56e0-44d6-b114-49eaab02f033"
@@ -29962,10 +29986,6 @@
0,
0.36
],
"rof": [
0,
0.36
],
"thermload": [
0.01,
0.01
@@ -29987,10 +30007,6 @@
0.36,
0.52
],
"rof": [
0.36,
0.52
],
"thermload": [
0.02,
0.02
@@ -30013,10 +30029,6 @@
0.52,
0.68
],
"rof": [
0.52,
0.68
],
"thermload": [
0.03,
0.03
@@ -30039,10 +30051,6 @@
0.68,
0.84
],
"rof": [
0.68,
0.84
],
"thermload": [
0.04,
0.04
@@ -30065,10 +30073,6 @@
0.84,
1
],
"rof": [
0.84,
1
],
"thermload": [
0.05,
0.05

View File

@@ -9267,7 +9267,7 @@
],
"shieldboost": [
0.372,
0.456
0.38
]
},
"uuid": "933e238e-56e0-44d6-b114-49eaab02f033"
@@ -11002,10 +11002,6 @@
0,
0.36
],
"rof": [
0,
0.36
],
"thermload": [
0.01,
0.01
@@ -11027,10 +11023,6 @@
0.36,
0.52
],
"rof": [
0.36,
0.52
],
"thermload": [
0.02,
0.02
@@ -11053,10 +11045,6 @@
0.52,
0.68
],
"rof": [
0.52,
0.68
],
"thermload": [
0.03,
0.03
@@ -11079,10 +11067,6 @@
0.68,
0.84
],
"rof": [
0.68,
0.84
],
"thermload": [
0.04,
0.04
@@ -11105,10 +11089,6 @@
0.84,
1
],
"rof": [
0.84,
1
],
"thermload": [
0.05,
0.05

View File

@@ -111,6 +111,30 @@
"name": "Corrosion Resistant",
"rating": "F",
"symbol": "Int_CorrosionProofCargoRack_Size1_Class2"
},
{
"cargo": 4,
"class": 2,
"cost": 12563,
"edID": 128681992,
"eddbID": 1552,
"grp": "cr",
"id": "0V",
"name": "Corrosion Resistant",
"rating": "F",
"symbol": "Int_CorrosionProofCargoRack_Size2_Class1"
},
{
"cargo": 16,
"class": 4,
"cost": 94330,
"edID": 128681992,
"eddbID": 1552,
"grp": "cr",
"id": "0W",
"name": "Corrosion Resistant",
"rating": "E",
"symbol": "Int_CorrosionProofCargoRack_Size4_Class1"
}
]
}

View File

@@ -493,7 +493,7 @@
{
"class": 2,
"cost": 162000,
"edID": 128064037,
"edID": 128833988,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -508,7 +508,7 @@
{
"class": 3,
"cost": 291600,
"edID": 128064037,
"edID": 128833989,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -523,7 +523,7 @@
{
"class": 4,
"cost": 524880,
"edID": 128064037,
"edID": 128833990,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -538,7 +538,7 @@
{
"class": 5,
"cost": 944790,
"edID": 128064037,
"edID": 128833991,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -553,7 +553,7 @@
{
"class": 6,
"cost": 1700610,
"edID": 128064037,
"edID": 128833992,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -568,7 +568,7 @@
{
"class": 7,
"cost": 3061100,
"edID": 128064037,
"edID": 128833993,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",
@@ -583,7 +583,7 @@
{
"class": 8,
"cost": 5509980,
"edID": 128064037,
"edID": 128833994,
"eddbID": 895,
"eff": 0.5,
"grp": "pp",

View File

@@ -10,7 +10,7 @@
"speed": 230,
"boost": 330,
"boostEnergy": 19,
"baseShieldStrength": 154,
"baseShieldStrength": 200,
"baseArmour": 280,
"hardness": 65,
"hullMass": 400,

View File

@@ -1,232 +1,230 @@
var Modules = require('../modules');
var Ships = require('../ships');
var Modifications = require('../modifications');
const Modules = require('../modules');
const Ships = require('../ships');
const Modifications = require('../modifications');
describe('JSON Data', function() {
describe('JSON Data', () => {
const shipProperties = [
'name',
'manufacturer',
'class',
'hullCost',
'speed',
'boost',
'boostEnergy',
'baseShieldStrength',
'baseArmour',
'hardness',
'hullMass',
'masslock',
'pipSpeed',
'pitch',
'roll',
'yaw',
'crew'
];
var shipProperties = [
'name',
'manufacturer',
'class',
'hullCost',
'speed',
'boost',
'boostEnergy',
'baseShieldStrength',
'baseArmour',
'hardness',
'hullMass',
'masslock',
'pipSpeed',
'pitch',
'roll',
'yaw',
'crew'
];
const edIDs = {};
const eddbIDs = {};
var edIDs = {};
var eddbIDs = {};
it('has an up-to-date distribution', () => {
const dist = require('../dist');
expect(dist.Ships).toEqual(Ships, 'Distribution ships does not match. Did you run `npm start`?');
expect(dist.Modules).toEqual(Modules, 'Distribution modules does not match. Did you run `npm start`?');
});
it('has an up-to-date distribution', function() {
var dist = require('../dist/index.js');
expect(dist.Ships).toEqual(Ships, 'Distribution ships does not match. Did you run `npm start`?');
expect(dist.Modules).toEqual(Modules, 'Distribution modules does not match. Did you run `npm start`?');
});
it('has valid standard modules', function() {
var ids = {};
for (var s in Modules.standard) {
var group = Modules.standard[s];
for (var i = 0; i < group.length; i++) {
var id = group[i].id;
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].edID > 0).toBeTruthy('Standard module ' + id + ' is missing E:D ID');
expect(group[i].eddbID > 0).toBeTruthy('Standard module ' + id + ' is missing EDDB ID');
if (s != 'ft' && s != 'pas' ) {
expect(group[i].integrity).toBeDefined('Standard module ' + id + ' is missing integrity');
}
expect(group[i].grp).toBeDefined(`No group defined, Type: ${s}, ID: ${id}, Index: ${i}`);
expect(eddbIDs[group[i].eddbID]).toBeFalsy(`EDDB ID [${group[i].eddbID}] already exists for ID: ${id}, Index: ${i}`);
expect(edIDs[group[i].edID]).toBeFalsy(`E:D ID [${group[i].edID}] already exists for ID: ${id}, Index: ${i}`);
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
ids[id] = true;
}
}
});
it('has valid hardpoints', function() {
var ids = {};
for (var g in Modules.hardpoints) {
var group = Modules.hardpoints[g];
for (var i = 0; i < group.length; i++) {
var id = group[i].id;
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].grp).toBeDefined('Hardpoint has no group defined, ID:' + id);
expect(group[i].mass).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing mass`);
expect(group[i].integrity).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing integrity`);
expect(group[i].eddbID > 0).toBeTruthy(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
expect(group[i].edID > 0).toBeTruthy(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
it('has valid standard modules', () => {
const ids = {};
for (const s in Modules.standard) {
const group = Modules.standard[s];
for (let i = 0; i < group.length; i++) {
const id = group[i].id;
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].edID > 0).toBeTruthy('Standard module ' + id + ' is missing E:D ID');
expect(group[i].eddbID > 0).toBeTruthy('Standard module ' + id + ' is missing EDDB ID');
if (s != 'ft' && s != 'pas') {
expect(group[i].integrity).toBeDefined('Standard module ' + id + ' is missing integrity');
}
expect(group[i].grp).toBeDefined(`No group defined, Type: ${s}, ID: ${id}, Index: ${i}`);
expect(eddbIDs[group[i].eddbID]).toBeFalsy(`EDDB ID [${group[i].eddbID}] already exists: ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''}`);
expect(edIDs[group[i].edID]).toBeFalsy(`E:D ID [${group[i].edID}] already exists: ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''}`);
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
if (group[i].damage) {
expect(group[i].damage).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing damage`);
expect(group[i].damagedist).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing damage distribution`);
if (group[i].grp != 'po') {
expect(group[i].thermload).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing thermload`);
expect(group[i].breachmin).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachmin`);
expect(group[i].breachmax).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachmax`);
expect(group[i].breachdmg).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachdmg`);
expect(group[i].piercing).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing piercing`);
expect(group[i].distdraw).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing distdraw`);
}
}
if ((group[i].ammo || group[i].reload || group[i].clip) && g != 'hs' && g != 'ec') {
expect(group[i].ammo).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing ammo`);
expect(group[i].clip).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing clip`);
expect(group[i].reload).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing reload`);
}
ids[id] = true;
}
}
});
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
ids[id] = true;
}
}
});
it('has valid internal modules', function() {
var ids = {};
it('has valid hardpoints', () => {
const ids = {};
for (var g in Modules.internal) {
var group = Modules.internal[g];
for (var i = 0; i < group.length; i++) {
var id = group[i].id;
expect(group[i].grp).toBeDefined(`No group defined, ID: ${id}`);
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].eddbID > 0).toBeTruthy(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
expect(group[i].edID > 0).toBeTruthy(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
if (group[i].grp != 'ft') { // Standard and Internal Fuel tanks have the same IDs
expect(eddbIDs[group[i].eddbID]).toBeFalsy(`EDDB ID [${group[i].eddbID}] already exists: ${id}`);
expect(edIDs[group[i].edID]).toBeFalsy(`E:D ID [${group[i].edID}] already exists: ${id}`);
}
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
ids[id] = true;
}
}
});
for (const g in Modules.hardpoints) {
const group = Modules.hardpoints[g];
for (let i = 0; i < group.length; i++) {
const id = group[i].id;
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].grp).toBeDefined('Hardpoint has no group defined, ID:' + id);
expect(group[i].mass).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing mass`);
expect(group[i].integrity).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing integrity`);
expect(group[i].eddbID > 0).toBeTruthy(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
expect(group[i].edID > 0).toBeTruthy(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
expect(eddbIDs[group[i].eddbID]).toBeFalsy(`EDDB ID [${group[i].eddbID}] already exists: ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''}`);
expect(edIDs[group[i].edID]).toBeFalsy(`E:D ID [${group[i].edID}] already exists: ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''}`);
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
if (group[i].damage) {
expect(group[i].damage).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing damage`);
expect(group[i].damagedist).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing damage distribution`);
if (group[i].grp != 'po') {
expect(group[i].thermload).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing thermload`);
expect(group[i].breachmin).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachmin`);
expect(group[i].breachmax).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachmax`);
expect(group[i].breachdmg).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing breachdmg`);
expect(group[i].piercing).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing piercing`);
expect(group[i].distdraw).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing distdraw`);
}
}
if ((group[i].ammo || group[i].reload || group[i].clip) && g != 'hs' && g != 'ec') {
expect(group[i].ammo).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing ammo`);
expect(group[i].clip).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing clip`);
expect(group[i].reload).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing reload`);
}
ids[id] = true;
}
}
});
it('has data for every ship', function() {
var bulkheadIds = {};
it('has valid internal modules', () => {
const ids = {};
for (var s in Ships) {
for (var p = 0; p < shipProperties.length; p++) {
expect(Ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
}
expect(Ships[s].eddbID > 0).toBeTruthy(s + ' is missing EDDB ID');
expect(Ships[s].edID > 0).toBeTruthy(s + ' is missing E:D ID');
expect(edIDs[Ships[s].edID]).toBeFalsy(`${s} E:D ID [${Ships[s].edID}] already exists`);
expect(Ships[s].slots.standard.length).toEqual(7, s + ' is missing standard slots');
expect(Ships[s].defaults.standard.length).toEqual(7, s + ' is missing standard defaults');
expect(Ships[s].slots.hardpoints.length).toEqual(Ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match');
expect(Ships[s].slots.internal.length).toEqual(Ships[s].defaults.internal.length, s + ' internal slots and defaults dont match');
expect(Ships[s].retailCost).toBeGreaterThan(Ships[s].properties.hullCost, s + ' has invalid retail cost');
expect(Ships[s].bulkheads).toBeDefined(s + ' is missing bulkheads');
expect(Ships[s].bulkheads.length).toEqual(5, s + ' is missing bulkheads');
if (Ships[s].edID) {
edIDs[Ships[s].edID] = true;
}
for (const g in Modules.internal) {
const group = Modules.internal[g];
for (let i = 0; i < group.length; i++) {
const id = group[i].id;
expect(group[i].grp).toBeDefined(`No group defined, ID: ${id}`);
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
expect(group[i].eddbID > 0).toBeTruthy(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
expect(group[i].edID > 0).toBeTruthy(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
if (group[i].grp != 'ft') { // Standard and Internal Fuel tanks have the same IDs
expect(eddbIDs[group[i].eddbID]).toBeFalsy(`EDDB ID [${group[i].eddbID}] already exists: ${id}`);
expect(edIDs[group[i].edID]).toBeFalsy(`E:D ID [${group[i].edID}] already exists: ${id}`);
}
if (group[i].eddbID) {
eddbIDs[group[i].eddbID] = true;
}
if (group[i].edID) {
edIDs[group[i].edID] = true;
}
ids[id] = true;
}
}
});
for (var i = 0; i < Ships[s].bulkheads.length; i++) {
var b = Ships[s].bulkheads[i];
expect(b.id).toBeDefined(`${s} bulkhead [${i}] is missing an ID`);
expect(bulkheadIds[b.id]).toBeFalsy(`${s} bulkhead [${i} - ${b.id}] ID already exists`);
expect(b.eddbID > 0).toBeTruthy(`${s} bulkhead [${i} - ${b.id}] is missing EDDB ID`);
expect(eddbIDs[b.eddbID]).toBeFalsy(`EDDB ID [${b.eddbID}] already exists: ${s} bulkhead [${i} - ${b.id}]`);
expect(b.edID > 0).toBeTruthy(`${s} bulkhead [${i} - ${b.id}] is missing E:D ID`);
expect(edIDs[b.edID]).toBeFalsy(`E:D ID [${b.edID}] already exists: ${s} bulkhead [${i} - ${b.id}]`);
if (b.eddbID) {
eddbIDs[b.eddbID] = true;
}
if (b.edID) {
edIDs[b.edID] = true;
}
bulkheadIds[b.id] = true;
}
}
});
it('has data for every ship', () => {
const bulkheadIds = {};
it('has valid blueprints', function() {
var ids = {};
var names = {};
for (const s in Ships) {
for (let p = 0; p < shipProperties.length; p++) {
expect(Ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
}
expect(Ships[s].eddbID > 0).toBeTruthy(s + ' is missing EDDB ID');
expect(Ships[s].edID > 0).toBeTruthy(s + ' is missing E:D ID');
expect(edIDs[Ships[s].edID]).toBeFalsy(`${s} E:D ID [${Ships[s].edID}] already exists`);
expect(Ships[s].slots.standard.length).toEqual(7, s + ' is missing standard slots');
expect(Ships[s].defaults.standard.length).toEqual(7, s + ' is missing standard defaults');
expect(Ships[s].slots.hardpoints.length).toEqual(Ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match');
expect(Ships[s].slots.internal.length).toEqual(Ships[s].defaults.internal.length, s + ' internal slots and defaults dont match');
expect(Ships[s].retailCost).toBeGreaterThan(Ships[s].properties.hullCost, s + ' has invalid retail cost');
expect(Ships[s].bulkheads).toBeDefined(s + ' is missing bulkheads');
expect(Ships[s].bulkheads.length).toEqual(5, s + ' is missing bulkheads');
if (Ships[s].edID) {
edIDs[Ships[s].edID] = true;
}
for (var blueprintname in Modifications.blueprints) {
const blueprint = Modifications.blueprints[blueprintname];
expect(names[blueprintname]).toBeFalsy('Name already exists: ' + blueprintname);
names[blueprintname] = true;
expect(ids[blueprint.id]).toBeFalsy('ID already exists: ' + blueprint.id);
ids[blueprint.id] = true;
expect(blueprint.name).toBeDefined('Blueprint has no name, ID:' + blueprint.id);
expect(blueprint.grades).toBeDefined('Blueprint has no grades, ID:' + blueprint.id);
for (let i = 0; i < Ships[s].bulkheads.length; i++) {
const b = Ships[s].bulkheads[i];
expect(b.id).toBeDefined(`${s} bulkhead [${i}] is missing an ID`);
expect(bulkheadIds[b.id]).toBeFalsy(`${s} bulkhead [${i} - ${b.id}] ID already exists`);
expect(b.eddbID > 0).toBeTruthy(`${s} bulkhead [${i} - ${b.id}] is missing EDDB ID`);
expect(eddbIDs[b.eddbID]).toBeFalsy(`EDDB ID [${b.eddbID}] already exists: ${s} bulkhead [${i} - ${b.id}]`);
expect(b.edID > 0).toBeTruthy(`${s} bulkhead [${i} - ${b.id}] is missing E:D ID`);
expect(edIDs[b.edID]).toBeFalsy(`E:D ID [${b.edID}] already exists: ${s} bulkhead [${i} - ${b.id}]`);
if (b.eddbID) {
eddbIDs[b.eddbID] = true;
}
if (b.edID) {
edIDs[b.edID] = true;
}
bulkheadIds[b.id] = true;
}
}
});
grades = {}
for (var grade in blueprint.grades) {
expect(grades[grade]).toBeFalsy('Grade already exists: ' + grade + ' for ' + blueprintname);
grades[grade] = true;
it('has valid blueprints', () => {
const ids = {};
const names = {};
const blueprintgrade = blueprint.grades[grade];
expect(blueprintgrade.components).toBeDefined('Blueprint grade ' + grade + ' has no components for ' + blueprintname);
expect(blueprintgrade.features).toBeDefined('Blueprint grade ' + grade + ' has no features for ' + blueprintname);
}
}
});
for (const blueprintname in Modifications.blueprints) {
const blueprint = Modifications.blueprints[blueprintname];
expect(names[blueprintname]).toBeFalsy('Name already exists: ' + blueprintname);
names[blueprintname] = true;
expect(ids[blueprint.id]).toBeFalsy('ID already exists: ' + blueprint.id);
ids[blueprint.id] = true;
expect(blueprint.name).toBeDefined('Blueprint has no name, ID:' + blueprint.id);
expect(blueprint.grades).toBeDefined('Blueprint has no grades, ID:' + blueprint.id);
it('has valid modifications', function() {
var ids = {};
grades = {};
for (const grade in blueprint.grades) {
expect(grades[grade]).toBeFalsy('Grade already exists: ' + grade + ' for ' + blueprintname);
grades[grade] = true;
for (var k in Modifications.modifications) {
const modification = Modifications.modifications[k];
expect(ids[modification.id]).toBeFalsy('ID already exists: ' + modification.id);
expect(modification.name).toBeDefined('Modification has no name, ID:' + modification.id);
expect(modification.type).toBeDefined('Modification has no type, ID:' + modification.id);
expect(modification.method).toBeDefined('Modification has no method, ID:' + modification.id);
ids[modification.id] = true;
}
});
const blueprintgrade = blueprint.grades[grade];
expect(blueprintgrade.components).toBeDefined('Blueprint grade ' + grade + ' has no components for ' + blueprintname);
expect(blueprintgrade.features).toBeDefined('Blueprint grade ' + grade + ' has no features for ' + blueprintname);
}
}
});
it('has valid module modifications', function() {
for (var m in Modifications.modules) {
const module = Modifications.modules[m];
for (var bp in module.blueprints) {
expect(Modifications.blueprints[bp]).toBeDefined('Missing ' + bp + ' for ' + m);
for (var grade in module.blueprints[bp].grades) {
expect(Modifications.blueprints[bp].grades[grade]).toBeDefined('Missing ' + bp + ' grade ' + grade + ' for ' + m);
}
}
}
});
it('has valid modifications', () => {
const ids = {};
it('has valid specials', function() {
var ids = {};
for (const k in Modifications.modifications) {
const modification = Modifications.modifications[k];
expect(ids[modification.id]).toBeFalsy('ID already exists: ' + modification.id);
expect(modification.name).toBeDefined('Modification has no name, ID:' + modification.id);
expect(modification.type).toBeDefined('Modification has no type, ID:' + modification.id);
expect(modification.method).toBeDefined('Modification has no method, ID:' + modification.id);
ids[modification.id] = true;
}
});
for (var k in Modifications.specials) {
const special = Modifications.specials[k];
expect(ids[special.id]).toBeFalsy('ID already exists: ' + special.id);
expect(special.name).toBeDefined('Special has no name, ID:' + special.id);
ids[special.id] = true;
}
});
it('has valid module modifications', () => {
for (const m in Modifications.modules) {
const module = Modifications.modules[m];
for (const bp in module.blueprints) {
expect(Modifications.blueprints[bp]).toBeDefined('Missing ' + bp + ' for ' + m);
for (const grade in module.blueprints[bp].grades) {
expect(Modifications.blueprints[bp].grades[grade]).toBeDefined('Missing ' + bp + ' grade ' + grade + ' for ' + m);
}
}
}
});
it('has valid specials', () => {
const ids = {};
for (const k in Modifications.specials) {
const special = Modifications.specials[k];
expect(ids[special.id]).toBeFalsy('ID already exists: ' + special.id);
expect(special.name).toBeDefined('Special has no name, ID:' + special.id);
ids[special.id] = true;
}
});
});