mirror of
https://github.com/EDCD/coriolis-data.git
synced 2025-12-09 07:33:24 +00:00
Tweak tests
This commit is contained in:
@@ -19,6 +19,9 @@ describe('JSON Data', function() {
|
|||||||
'pipSpeed'
|
'pipSpeed'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var edIDs = {};
|
||||||
|
var eddbIDs = {};
|
||||||
|
|
||||||
it('has an up-to-date distribution', function() {
|
it('has an up-to-date distribution', function() {
|
||||||
var dist = require('../dist/index.js');
|
var dist = require('../dist/index.js');
|
||||||
expect(dist.Ships).toEqual(Ships, 'Distribution ships does not match. Did you run `npm start`?');
|
expect(dist.Ships).toEqual(Ships, 'Distribution ships does not match. Did you run `npm start`?');
|
||||||
@@ -35,6 +38,10 @@ describe('JSON Data', function() {
|
|||||||
expect(group[i].edID).toBeDefined('Standard module' + id + ' is missing E:D ID');
|
expect(group[i].edID).toBeDefined('Standard module' + id + ' is missing E:D ID');
|
||||||
expect(group[i].eddbID).toBeDefined('Standard module' + id + ' is missing EDDB ID');
|
expect(group[i].eddbID).toBeDefined('Standard module' + id + ' is missing EDDB ID');
|
||||||
expect(group[i].grp).toBeDefined(`No group defined, Type: ${s}, ID: ${id}, Index: ${i}`);
|
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}`);
|
||||||
|
eddbIDs[group[i].eddbID] = true;
|
||||||
|
edIDs[group[i].edID] = true;
|
||||||
ids[id] = true;
|
ids[id] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,6 +59,12 @@ describe('JSON Data', function() {
|
|||||||
expect(group[i].grp).toBeDefined('Hardpoint has no group defined, ID:' + id);
|
expect(group[i].grp).toBeDefined('Hardpoint has no group defined, ID:' + id);
|
||||||
expect(group[i].eddbID).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
|
expect(group[i].eddbID).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
|
||||||
expect(group[i].edID).toBeDefined(`Hardpoint ${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
|
expect(group[i].edID).toBeDefined(`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 : ''}`);
|
||||||
|
eddbIDs[group[i].eddbID] = true;
|
||||||
|
if (group[i].edID) {
|
||||||
|
edIDs[group[i].edID] = true;
|
||||||
|
}
|
||||||
ids[id] = true;
|
ids[id] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,10 +78,16 @@ describe('JSON Data', function() {
|
|||||||
var group = groups[g];
|
var group = groups[g];
|
||||||
for (var i = 0; i < group.length; i++) {
|
for (var i = 0; i < group.length; i++) {
|
||||||
var id = group[i].id;
|
var id = group[i].id;
|
||||||
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
|
|
||||||
expect(group[i].grp).toBeDefined(`No group defined, ID: ${id}`);
|
expect(group[i].grp).toBeDefined(`No group defined, ID: ${id}`);
|
||||||
|
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
|
||||||
expect(group[i].eddbID).toBeDefined(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
|
expect(group[i].eddbID).toBeDefined(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing EDDB ID`);
|
||||||
expect(group[i].edID).toBeDefined(`${group[i].grp}:${id} ${group[i].name ? group[i].name : ''} is missing E:D ID`);
|
expect(group[i].edID).toBeDefined(`${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}`);
|
||||||
|
}
|
||||||
|
eddbIDs[group[i].eddbID] = true;
|
||||||
|
edIDs[group[i].edID] = true;
|
||||||
ids[id] = true;
|
ids[id] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +100,8 @@ describe('JSON Data', function() {
|
|||||||
expect(Ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
|
expect(Ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
|
||||||
}
|
}
|
||||||
expect(Ships[s].eddbID).toBeDefined(s + ' is missing EDDB ID');
|
expect(Ships[s].eddbID).toBeDefined(s + ' is missing EDDB ID');
|
||||||
|
// TODO: Get Ids, see github issue https://github.com/cmmcleod/coriolis-data/issues/6
|
||||||
|
// expect(Ships[s].edID).toBeDefined(s + ' is missing E:D ID');
|
||||||
expect(Ships[s].slots.standard.length).toEqual(7, s + ' is missing standard slots');
|
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].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.hardpoints.length).toEqual(Ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match');
|
||||||
@@ -94,8 +115,12 @@ describe('JSON Data', function() {
|
|||||||
expect(b.id).toBeDefined(`${s} bulkhead [${i}] is missing an ID`);
|
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(bulkheadIds[b.id]).toBeFalsy(`${s} bulkhead [${i} - ${b.id}] ID already exists`);
|
||||||
expect(b.eddbID).toBeDefined(`${s} bulkhead [${i} - ${b.id}] is missing EDDB ID`);
|
expect(b.eddbID).toBeDefined(`${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}]`);
|
||||||
// TODO: Get Ids, see github issue https://github.com/cmmcleod/coriolis-data/issues/6
|
// TODO: Get Ids, see github issue https://github.com/cmmcleod/coriolis-data/issues/6
|
||||||
//expect(b.edId).toBeDefined(`${s} bulkhead [${i} - ${b.id}] is missing E:D ID`);
|
// expect(b.edId).toBeDefined(`${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}]`);
|
||||||
|
// edIDs[b.edID] = true;
|
||||||
|
eddbIDs[b.eddbID] = true;
|
||||||
bulkheadIds[b.id] = true;
|
bulkheadIds[b.id] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user