diff --git a/lib/CustomMySQL.js b/lib/CustomMySQL.js index 019c8b0..9351f3a 100644 --- a/lib/CustomMySQL.js +++ b/lib/CustomMySQL.js @@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _Transaction = require('./Transaction'); @@ -63,10 +61,6 @@ var CustomMySQL = function () { throw new Error('key should be a string'); } - if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) !== 'object') { - throw new Error('config should be an object'); - } - this._key = key; this[key] = { config: config }; this[key].is_pool = !!is_pool; diff --git a/src/CustomMySQL.js b/src/CustomMySQL.js index edeb154..33c52a5 100644 --- a/src/CustomMySQL.js +++ b/src/CustomMySQL.js @@ -37,10 +37,6 @@ export default class CustomMySQL { throw new Error('key should be a string'); } - if (typeof config !== 'object') { - throw new Error('config should be an object'); - } - this._key = key; this[key] = {config}; this[key].is_pool = !!is_pool; diff --git a/test/test.js b/test/test.js index a26de4c..dfb9245 100644 --- a/test/test.js +++ b/test/test.js @@ -2,12 +2,8 @@ const should = require('chai').should(); const CustomMySQL = require(process.cwd() + '/lib/CustomMySQL').default; -const FREE_DB = { - host: 'localhost', - user: 'root', - password: '', - database: 'test' -}; + +const FREE_DB = 'mysql://root:@localhost/test'; const FREE_DB2 = { host: 'localhost', user: 'root', @@ -122,18 +118,6 @@ describe('Overall test', () => { - it ('mysql.add should throw an error if config is not an object', (done) => { - const mysql = new CustomMySQL(); - - (() => { - mysql.add('key', 1); - }).should.throw(Error, 'config should be an object'); - - done(); - }); - - - it ('mysql.add should create a property for a newly added key-config pair', (done) => { const mysql = new CustomMySQL();