Refactor many variable names, adding detailed json dump and schema

This commit is contained in:
Colin McLeod
2015-07-14 21:44:12 -07:00
parent cd48ef6f86
commit 4578dbf906
34 changed files with 560 additions and 190 deletions

View File

@@ -1,8 +1,8 @@
describe("Database", function() {
describe('Database', function() {
var shipProperties = ["grp", "name", "manufacturer", "class", "cost", "speed", "boost", "agility", "shields", "armour", "fuelcost", "mass"];
var shipProperties = ['name', 'manufacturer', 'class', 'hullCost', 'speed', 'boost', 'agility', 'baseShieldStrength', 'baseArmour', 'hullMass', 'masslock'];
it("has ships and components", function() {
it('has ships and components', function() {
expect(DB.ships).toBeDefined()
expect(DB.components.common).toBeDefined();
expect(DB.components.hardpoints).toBeDefined();
@@ -10,7 +10,7 @@ describe("Database", function() {
expect(DB.components.bulkheads).toBeDefined();
});
it("has unique IDs for every hardpoint", function() {
it('has unique IDs for every hardpoint', function() {
var ids = {};
var groups = DB.components.hardpoints;
@@ -25,7 +25,7 @@ describe("Database", function() {
}
});
it("has valid internal components", function() {
it('has valid internal components', function() {
var ids = {};
var groups = DB.components.internal;
@@ -40,7 +40,7 @@ describe("Database", function() {
}
});
it("has data for every ship", function() {
it('has data for every ship', function() {
for (var s in DB.ships) {
for (var p = 0; p < shipProperties.length; p++) {
expect(DB.ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s);
@@ -49,12 +49,12 @@ describe("Database", function() {
expect(DB.ships[s].defaults.common.length).toEqual(7, s + ' is missing common defaults');
expect(DB.ships[s].slots.hardpoints.length).toEqual(DB.ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match');
expect(DB.ships[s].slots.internal.length).toEqual(DB.ships[s].defaults.internal.length, s + ' hardpoint slots and defaults dont match');
expect(DB.ships[s].retailCost).toBeGreaterThan(DB.ships[s].properties.cost, s + ' has invalid retail cost');
expect(DB.ships[s].retailCost).toBeGreaterThan(DB.ships[s].properties.hullCost, s + ' has invalid retail cost');
expect(DB.components.bulkheads[s]).toBeDefined(s + ' is missing bulkheads');
}
});
it("has components with a group defined", function() {
it('has components with a group defined', function() {
for (var i = 0; i < DB.components.common.length; i++) {
var group = DB.components.common[i];
for (var c in group) {