From: himetani_cafe Date: Fri, 22 Jan 2016 06:59:10 +0000 (+0900) Subject: Install sqlite3 and sequelize X-Git-Tag: v0.3.0p0006~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=203d77bd3c6114d6d44383314aaa7c6090de45fb;p=eos%2Fzephyr.git Install sqlite3 and sequelize --- diff --git a/package.json b/package.json index a03fad2..87a8bf8 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,9 @@ "chalk": "^1.1.1", "commander": "^2.9.0", "express": "^4.13.3", - "sequelize": "^3.15.1", - "socket.io": "^1.3.7" + "sequelize": "^3.18.0", + "socket.io": "^1.3.7", + "sqlite3": "^3.1.1" }, "devDependencies": { "chai": "^3.4.1", diff --git a/server/class/DB.js b/server/class/DB.js new file mode 100644 index 0000000..c8f3efe --- /dev/null +++ b/server/class/DB.js @@ -0,0 +1,9 @@ + +/** + * DBを操作するクラス + * + * @returns {object} + */ +function DB() { + +} diff --git a/test/mocha/DB.test.js b/test/mocha/DB.test.js new file mode 100644 index 0000000..892d2cc --- /dev/null +++ b/test/mocha/DB.test.js @@ -0,0 +1,9 @@ +(function() { + 'use strict'; + var DB = require('../../server/class/DB'); + var expect = require('chai').expect; + + describe('DB クラス', function() { + + }) +})(); diff --git a/test/mocha/Eos.test.js b/test/mocha/Eos.test.js index ed73de0..2095365 100644 --- a/test/mocha/Eos.test.js +++ b/test/mocha/Eos.test.js @@ -1,108 +1,111 @@ -var Eos = require('../../server/class/Eos'); -var expect = require('chai').expect; - -var test1 = ` -/** -* コマンドとオプションのバリデーション -* @param {string} Eosコマンドの名前 -* @param {Array} コマンドに渡すオプション -* @returns {valid: boolean, message: string} -* function validate(command, params) { -*/ -`; - -var test2 = ` -/** -* 実行時文字列への変換 -* -* @param command -* @param options -* @returns {string} -* function toExecString(command, params) { -*/ -`; - -describe('Eos クラス', function() { - var eos; - before(function() { - eos = new Eos(); - }); - - describe(test1, function() { - - it('should return false when the command is typeof number.', function() { - var result = eos.validate(2); - expect(result.message).to.equal('Command parameter need to be string'); - }); - - it('should return false when command name is invalid', function() { - var result = eos.validate('hoge'); - expect(result.message).to.equal('Command name is invalid'); - }); - - it('should return false when options is not Array', function() { - var result = eos.validate('mrcImageInfo', {}); - expect(result.message).to.equal('Options need to be Array'); +(function() { + 'use strict'; + var Eos = require('../../server/class/Eos'); + var expect = require('chai').expect; + + var test1 = ` + /** + * コマンドとオプションのバリデーション + * @param {string} Eosコマンドの名前 + * @param {Array} コマンドに渡すオプション + * @returns {valid: boolean, message: string} + * function validate(command, params) { + */ + `; + + var test2 = ` + /** + * 実行時文字列への変換 + * + * @param command + * @param options + * @returns {string} + * function toExecString(command, params) { + */ + `; + + describe('Eos クラス', function() { + var eos; + before(function() { + eos = new Eos(); }); - it('should return false when options is Array whose length is 0.', function() { - var result = eos.validate('mrcImageInfo', []); - expect(result.message).to.equal('At least one option is required.'); + describe(test1, function() { + + it('should return false when the command is typeof number.', function() { + var result = eos.validate(2); + expect(result.message).to.equal('Command parameter need to be string'); + }); + + it('should return false when command name is invalid', function() { + var result = eos.validate('hoge'); + expect(result.message).to.equal('Command name is invalid'); + }); + + it('should return false when options is not Array', function() { + var result = eos.validate('mrcImageInfo', {}); + expect(result.message).to.equal('Options need to be Array'); + }); + + it('should return false when options is Array whose length is 0.', function() { + var result = eos.validate('mrcImageInfo', []); + expect(result.message).to.equal('At least one option is required.'); + }); + + it('should return false when options is invalid Object which have not "name" and "argumetns"', function() { + var result = eos.validate('mrcImageInfo', [{hoge: 'hoge'}]); + expect(result.message).to.equal('Options need to include Object which have properties "name" and "arguments"'); + }); + + it('should return false when "argumetns" properties are not Array', function() { + var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: 'hoge'}]); + expect(result.message).to.equal('Each "arguments" properties needs to be Array'); + }); + + it('should return false when "argumetns" properties are not Array', function() { + var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: 'hoge'}]); + expect(result.message).to.equal('Each "arguments" properties needs to be Array'); + }); + + it('should return false when required options do not exist', function() { + var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: []}]); + expect(result.message).to.equal('Option -i are required'); + }); + + it('should return false when required options do not exist', function() { + var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2]}, { name: '-i', arguments: []}, { name: '-o', arguments: []} ]); + expect(result.hasDone).to.equal(false); + console.log(result.message); + }); + + it('should return false when input file does not exist', function() { + var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['hoge.txt']}, { name: '-o', arguments: ['hoge.txt']} ]); + expect(result.hasDone).to.equal(false); + console.log(result.message); + + }); + + it('should return false when output file is not string', function() { + var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: [3]} ]); + expect(result.hasDone).to.equal(false); + console.log(result.message); + + }); + + it('should return false when output file has already existed', function() { + var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file1.txt']} ]); + expect(result.hasDone).to.equal(false); + console.log(result.message); + + }); }); - it('should return false when options is invalid Object which have not "name" and "argumetns"', function() { - var result = eos.validate('mrcImageInfo', [{hoge: 'hoge'}]); - expect(result.message).to.equal('Options need to include Object which have properties "name" and "arguments"'); - }); - - it('should return false when "argumetns" properties are not Array', function() { - var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: 'hoge'}]); - expect(result.message).to.equal('Each "arguments" properties needs to be Array'); - }); - - it('should return false when "argumetns" properties are not Array', function() { - var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: 'hoge'}]); - expect(result.message).to.equal('Each "arguments" properties needs to be Array'); - }); - - it('should return false when required options do not exist', function() { - var result = eos.validate('mrcImageInfo', [{name: 'hoge', arguments: []}]); - expect(result.message).to.equal('Option -i are required'); - }); - - it('should return false when required options do not exist', function() { - var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2]}, { name: '-i', arguments: []}, { name: '-o', arguments: []} ]); - expect(result.hasDone).to.equal(false); - console.log(result.message); - }); - - it('should return false when input file does not exist', function() { - var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['hoge.txt']}, { name: '-o', arguments: ['hoge.txt']} ]); - expect(result.hasDone).to.equal(false); - console.log(result.message); - - }); - - it('should return false when output file is not string', function() { - var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: [3]} ]); - expect(result.hasDone).to.equal(false); - console.log(result.message); - - }); - - it('should return false when output file has already existed', function() { - var result = eos.validate('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file1.txt']} ]); - expect(result.hasDone).to.equal(false); - console.log(result.message); - - }); - }); - - describe(test2, function() { + describe(test2, function() { - it('should return true when all options is proper.', function() { - var result = eos.toExecString('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file3.txt']} ]); - expect(result).to.equal('dcdFilePrint -r 1 2 3 -s 10 -e 100 -d 10 -m 0 -i file1.txt -o file3.txt'); + it('should return true when all options is proper.', function() { + var result = eos.toExecString('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file3.txt']} ]); + expect(result).to.equal('dcdFilePrint -r 1 2 3 -s 10 -e 100 -d 10 -m 0 -i file1.txt -o file3.txt'); + }); }); }); -}); +})();