diff --git a/package.json b/package.json index 6d6b9e2..3b2d306 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "phb": "node scripts/phb.js", "prod": "set NODE_ENV=production&& npm run build", "postinstall": "npm run build", - "start": "node server.js" + "start": "node server.js", + "test": "mocha --recursive test" }, "author": "stolksdorf", "license": "MIT", diff --git a/test/brew.datatest.js b/test/brew.datatest.js new file mode 100644 index 0000000..e69de29 diff --git a/test/config/testing.json b/test/config/testing.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/test/config/testing.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/test/test.init.js b/test/test.init.js new file mode 100644 index 0000000..b4f5023 --- /dev/null +++ b/test/test.init.js @@ -0,0 +1,29 @@ + +// initialize config +const config = require('nconf') + .argv() + .env({ lowerCase: true }) + .file('testing', { file: `./config/testing.json` }) + .file('environment', { file: `../config/${process.env.NODE_ENV}.json` }) + .file('defaults', { file: '../config/default.json' }); + +// other libs +const should = require('chai').use(require('chai-as-promised')).should(); + + + +module.exports = { + config: config, + should: should, + clearCache: () => { + return new Promise((resolve, reject) => { + Cache.getRawClientYesIKnowWhatImDoing() + .flushdb((err) => { + if (err) { + return reject(new Error(err)); + } + resolve(); + }); + }); + }, +};