mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Added EDDB IDs to data. Updating submodule
This commit is contained in:
2
data
2
data
Submodule data updated: 8edcc68cfe...5350fb5e07
@@ -1,12 +1,15 @@
|
||||
{
|
||||
"name": "coriolis_shipyard",
|
||||
"version": "1.8.3",
|
||||
"version": "1.9.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cmmcleod/coriolis"
|
||||
},
|
||||
"homepage": "http://coriolis.io",
|
||||
"bugs": "https://github.com/cmmcleod/coriolis/issues",
|
||||
"private": true,
|
||||
"engine": "node >= 0.12.2",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"angular-mocks": "1.4.x",
|
||||
"async": "0.9.x",
|
||||
|
||||
1
test/fixtures/eddb-modules.json
vendored
Normal file
1
test/fixtures/eddb-modules.json
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -16,6 +16,27 @@ describe('Database', function() {
|
||||
'pipSpeed'
|
||||
];
|
||||
|
||||
var eddbModules = __json__['fixtures/eddb-modules'];
|
||||
var eddbIdToModule = {};
|
||||
|
||||
for (var e = 0; e < eddbModules.length; e++) {
|
||||
eddbIdToModule[eddbModules[e].id] = eddbModules[e];
|
||||
}
|
||||
|
||||
function validateEDDBId (category, component) {
|
||||
var id = component.id;
|
||||
expect(component.eddbID).toBeDefined(category + ' ' + id + ' is missing EDDB ID');
|
||||
var eddbModule = eddbIdToModule[component.eddbID];
|
||||
|
||||
expect(eddbModule).toBeDefined(category + ' [' + id + ']: no EDDB Module found for EDDB ID ' + component.eddbID);
|
||||
expect(component.class == eddbModule.class).toBeTruthy(category + ' [' + id + '] class does not match ' + component.eddbID);
|
||||
expect(component.rating == eddbModule.rating).toBeTruthy(category + ' [' + id + '] rating does not match ' + component.eddbID);
|
||||
expect(component.mode === undefined || component.mode == eddbModule.weapon_mode.charAt(0))
|
||||
.toBeTruthy(category + ' [' + id + '] mode/mount does not match ' + component.eddbID);
|
||||
expect(component.name === undefined || (component.name == eddbModule.name || component.name == eddbModule.group.name))
|
||||
.toBeTruthy(category + ' [' + id + '] name does not match ' + component.eddbID);
|
||||
}
|
||||
|
||||
it('has ships and components', function() {
|
||||
expect(DB.ships).toBeDefined()
|
||||
expect(DB.components.standard).toBeDefined();
|
||||
@@ -24,7 +45,44 @@ describe('Database', function() {
|
||||
expect(DB.components.bulkheads).toBeDefined();
|
||||
});
|
||||
|
||||
it('has unique IDs for every hardpoint', function() {
|
||||
it('has same number of components as EDDB', function() {
|
||||
var totalComponentCount = 0, g;
|
||||
for (g = 0; g < DB.components.standard.length; g++) {
|
||||
var group = DB.components.standard[g];
|
||||
for (var i in group) {
|
||||
totalComponentCount++;
|
||||
}
|
||||
}
|
||||
for (g in DB.components.bulkheads) {
|
||||
totalComponentCount += 5;
|
||||
}
|
||||
for (g in DB.components.hardpoints) {
|
||||
totalComponentCount += DB.components.hardpoints[g].length;
|
||||
}
|
||||
for (g in DB.components.internal) {
|
||||
if (g != 'ft') { // EDDB does not have internal fuel tanks listed seperately
|
||||
totalComponentCount += DB.components.internal[g].length;
|
||||
}
|
||||
}
|
||||
expect(totalComponentCount).toEqual(eddbModules.length, 'Component count mismatch with EDDB');
|
||||
});
|
||||
|
||||
it('has valid standard components', function() {
|
||||
var ids = {};
|
||||
for (var i = 0; i < DB.components.standard.length; i++) {
|
||||
var group = DB.components.standard[i];
|
||||
for (var c in group) {
|
||||
var id = group[c].id;
|
||||
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
|
||||
expect(group[c].eddbID).toBeDefined('Standard component' + id + ' is missing EDDB ID');
|
||||
validateEDDBId('Standard', group[c]);
|
||||
expect(group[c].grp).toBeDefined('Common component has no group defined, Type: ' + i + ', ID: ' + c);
|
||||
ids[id] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('has valid hardpoints', function() {
|
||||
var ids = {};
|
||||
var groups = DB.components.hardpoints;
|
||||
|
||||
@@ -34,12 +92,13 @@ describe('Database', function() {
|
||||
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);
|
||||
validateEDDBId('Hardpoint', group[i]);
|
||||
ids[id] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('has unique IDs for every internal component', function() {
|
||||
it('has valid internal components', function() {
|
||||
var ids = {};
|
||||
var groups = DB.components.internal;
|
||||
|
||||
@@ -49,6 +108,7 @@ describe('Database', function() {
|
||||
var id = group[i].id;
|
||||
expect(ids[id]).toBeFalsy('ID already exists: ' + id);
|
||||
expect(group[i].grp).toBeDefined('Internal component has no group defined, ID:' + id);
|
||||
validateEDDBId('Internal', group[i]);
|
||||
ids[id] = true;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +119,7 @@ describe('Database', function() {
|
||||
for (var p = 0; p < shipProperties.length; p++) {
|
||||
expect(DB.ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
|
||||
}
|
||||
expect(DB.ships[s].eddbID).toBeDefined(s + ' is missing EDDB ID');
|
||||
expect(DB.ships[s].slots.standard.length).toEqual(7, s + ' is missing standard slots');
|
||||
expect(DB.ships[s].defaults.standard.length).toEqual(7, s + ' is missing standard defaults');
|
||||
expect(DB.ships[s].slots.hardpoints.length).toEqual(DB.ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match');
|
||||
@@ -68,13 +129,4 @@ describe('Database', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it('has components with a group defined', function() {
|
||||
for (var i = 0; i < DB.components.standard.length; i++) {
|
||||
var group = DB.components.standard[i];
|
||||
for (var c in group) {
|
||||
expect(group[c].grp).toBeDefined('Common component has no group defined, Type: ' + i + ', ID: ' + c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user