diff --git a/generate_distribution.js b/generate_distribution.js index 1b4638e..64d37c6 100644 --- a/generate_distribution.js +++ b/generate_distribution.js @@ -6,10 +6,10 @@ var exportString = JSON.stringify({ Ships: Ships, Modules: Modules }, null, '\t' var ast = UglifyJS.parse(['module.exports = ', JSON.stringify({ Ships: Ships, Modules: Modules }), ';'].join('')); var code = ast.print_to_string({beautify: true, indent_level: 2}); -fs.open('./index.js', 'w', function() { +fs.open('./dist/index.json', 'w', function() { fs.writeFile('./dist/index.js', code, function(err) {}); }); -fs.open('./index.json', 'w', function() { +fs.open('./dist/index.json', 'w', function() { fs.writeFile('./dist/index.json', exportString, function(err) {}); }); diff --git a/index.js b/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/index.json b/index.json deleted file mode 100644 index e69de29..0000000 diff --git a/spec/data-spec.js b/spec/data-spec.js index 9f6c401..20369a5 100644 --- a/spec/data-spec.js +++ b/spec/data-spec.js @@ -1,7 +1,7 @@ var Modules = require('../Modules'); var Ships = require('../Ships'); -describe('Database', function() { +describe('JSON Data', function() { var shipProperties = [ 'name', @@ -19,25 +19,10 @@ describe('Database', function() { 'pipSpeed' ]; - it('has same number of components as EDDB', function() { - var totalComponentCount = 0, g; - for (g = 0; g < Modules.standard.length; g++) { - var group = Modules.standard[g]; - for (var i in group) { - totalComponentCount++; - } - } - for (g in Modules.bulkheads) { - totalComponentCount += 5; - } - for (g in Modules.hardpoints) { - totalComponentCount += Modules.hardpoints[g].length; - } - for (g in Modules.internal) { - if (g != 'ft') { // EDDB does not have internal fuel tanks listed seperately - totalComponentCount += Modules.internal[g].length; - } - } + it('has an up-to-date distribution', function() { + var dist = require('../dist/index.js'); + expect(dist.Ships).toEqual(Ships); + expect(dist.Modules).toEqual(Modules); }); it('has valid standard components', function() { diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..b82adc7 --- /dev/null +++ b/travis.yml @@ -0,0 +1,14 @@ +language: node_js +notifications: + email: false +sudo: false +node_js: + - "4.2.6" +cache: + directories: + - node_modules + +before_script: + +script: + - npm test \ No newline at end of file