From 7ef7f0e75d972651bac2220683e0d8a4aee4287b Mon Sep 17 00:00:00 2001 From: AliLynne Date: Wed, 25 Oct 2017 10:12:49 -0700 Subject: [PATCH] set up first test --- app.js | 7 +++++++ package.json | 3 ++- {tests => test}/controllers/.gitignore | 0 {tests => test}/integration/.gitignore | 0 {tests => test}/middlewares/.gitignore | 0 {tests => test}/models/.gitignore | 0 test/test.js | 8 ++++++++ {tests => test}/ui/.gitignore | 0 8 files changed, 17 insertions(+), 1 deletion(-) rename {tests => test}/controllers/.gitignore (100%) rename {tests => test}/integration/.gitignore (100%) rename {tests => test}/middlewares/.gitignore (100%) rename {tests => test}/models/.gitignore (100%) create mode 100644 test/test.js rename {tests => test}/ui/.gitignore (100%) diff --git a/app.js b/app.js index 23c5e85..1e1540b 100644 --- a/app.js +++ b/app.js @@ -4,6 +4,7 @@ const routes = require('./routes') const index = require('./routes/index') const hello = require('./routes/hello'); + // Connect routes to application app.use('/', index); app.use('/hello', hello); @@ -13,7 +14,13 @@ app.get('/', (req, res) => { res.send('

I love consensus!

') }) +// view engine setup +app.set('views', path.join(__dirname, 'views')); +app.set('view engine', 'pug'); + // Turn on server! app.listen(3000, () => { console.log('The application is listening on port 3000') }) + +module.exports = app; diff --git a/package.json b/package.json index b112739..78f7957 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "app.js", "scripts": { "styletest": "standard", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "mocha" }, "keywords": [], "author": "", @@ -15,6 +15,7 @@ "pug": "^2.0.0-rc.4" }, "devDependencies": { + "mocha": "^4.0.1", "standard": "^10.0.3" } } diff --git a/tests/controllers/.gitignore b/test/controllers/.gitignore similarity index 100% rename from tests/controllers/.gitignore rename to test/controllers/.gitignore diff --git a/tests/integration/.gitignore b/test/integration/.gitignore similarity index 100% rename from tests/integration/.gitignore rename to test/integration/.gitignore diff --git a/tests/middlewares/.gitignore b/test/middlewares/.gitignore similarity index 100% rename from tests/middlewares/.gitignore rename to test/middlewares/.gitignore diff --git a/tests/models/.gitignore b/test/models/.gitignore similarity index 100% rename from tests/models/.gitignore rename to test/models/.gitignore diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..9592531 --- /dev/null +++ b/test/test.js @@ -0,0 +1,8 @@ +var assert = require('assert'); +describe('Array', function() { + describe('#indexOf()', function() { + it('should return -1 when the value is not present', function() { + assert.equal(-1, [1,2,3].indexOf(4)); + }); + }); +}); diff --git a/tests/ui/.gitignore b/test/ui/.gitignore similarity index 100% rename from tests/ui/.gitignore rename to test/ui/.gitignore