From bae34abd9ea7199a26358f0dd304b8be21166606 Mon Sep 17 00:00:00 2001 From: Mick van Gelderen Date: Fri, 19 Feb 2016 08:29:43 +0100 Subject: [PATCH] Remove src/config from master branch --- src/config/.gitignore | 2 -- src/config/EXAMPLE_VARIABLE.js | 3 --- src/config/defaults.js | 1 - src/config/locals.js | 3 --- src/config/readme.md | 2 -- src/config/util/get-string.js | 10 ---------- src/config/util/specifics.js | 18 ------------------ src/index.js | 6 ++++-- src/index.test.js | 10 ++++++++-- 9 files changed, 12 insertions(+), 43 deletions(-) delete mode 100644 src/config/.gitignore delete mode 100644 src/config/EXAMPLE_VARIABLE.js delete mode 100644 src/config/defaults.js delete mode 100644 src/config/locals.js delete mode 100644 src/config/readme.md delete mode 100644 src/config/util/get-string.js delete mode 100644 src/config/util/specifics.js diff --git a/src/config/.gitignore b/src/config/.gitignore deleted file mode 100644 index 52c8fe2..0000000 --- a/src/config/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/environments/ -/environments.js diff --git a/src/config/EXAMPLE_VARIABLE.js b/src/config/EXAMPLE_VARIABLE.js deleted file mode 100644 index 237153f..0000000 --- a/src/config/EXAMPLE_VARIABLE.js +++ /dev/null @@ -1,3 +0,0 @@ -import getString from './util/get-string' - -export default getString('EXAMPLE_VARIABLE') diff --git a/src/config/defaults.js b/src/config/defaults.js deleted file mode 100644 index b1c6ea4..0000000 --- a/src/config/defaults.js +++ /dev/null @@ -1 +0,0 @@ -export default {} diff --git a/src/config/locals.js b/src/config/locals.js deleted file mode 100644 index 5168acd..0000000 --- a/src/config/locals.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - EXAMPLE_VARIABLE: 'example-variable-value' -} diff --git a/src/config/readme.md b/src/config/readme.md deleted file mode 100644 index 286faad..0000000 --- a/src/config/readme.md +++ /dev/null @@ -1,2 +0,0 @@ - -If NODE_ENV is defined, the config will try to require('./environments'). You can create an `environments.js` file or a `environments` directory with an `index.js` file. This is useful if you have several deployment environments. \ No newline at end of file diff --git a/src/config/util/get-string.js b/src/config/util/get-string.js deleted file mode 100644 index 811595c..0000000 --- a/src/config/util/get-string.js +++ /dev/null @@ -1,10 +0,0 @@ -import assert from 'assert' -import specifics from './specifics' - -const getString = key => { - const value = process.env[key] || specifics[key] - assert.strictEqual(typeof value, 'string', `Expected configuration variable ${key} to be a string but it equals ${JSON.stringify(value)} with environment ${JSON.stringify(process.env.NODE_ENV)}.`) - return value -} - -export default getString diff --git a/src/config/util/specifics.js b/src/config/util/specifics.js deleted file mode 100644 index c9df64e..0000000 --- a/src/config/util/specifics.js +++ /dev/null @@ -1,18 +0,0 @@ -import defaults from '../defaults' - -const guardModuleExports = exports => - exports.__esModule === true ? - exports['default'] : - exports - -const specifics = Object.assign( - {}, - defaults, - guardModuleExports(require( - process.env.NODE_ENV && process.env.NODE_ENV !== 'development' ? - '../environments' : - '../locals' - )) -) - -export default specifics diff --git a/src/index.js b/src/index.js index ef54da9..3a4fd0c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ -import EXAMPLE_VARIABLE from './config/EXAMPLE_VARIABLE' +function hello() { + return 'Hello World!' +} -console.log(EXAMPLE_VARIABLE) // eslint-disable-line no-console +export default hello diff --git a/src/index.test.js b/src/index.test.js index bca1149..f8ac24e 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -1,7 +1,13 @@ /* eslint-env mocha */ +import hello from './' +import expect from 'must' describe(__filename, () => { - it('should run', () => { - require('./index') + it('should export a function', () => { + expect(hello).to.be.a.function() + }) + + it('should return "Hello World!" when called', () => { + expect(hello()).to.equal("Hello World!") }) })