diff --git a/app.js b/app.js index e81720b..be11e27 100644 --- a/app.js +++ b/app.js @@ -34,7 +34,7 @@ app.use(breadcrumb()) // Pass our application state and custom helpers to all our templates app.use(async function (req, res, next) { - // Inject ucstom helpers + // Inject custom helpers res.locals.helpers = helpers // Express query string diff --git a/package.json b/package.json index ac8e61c..7247f0a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "start:watch": "nodemon ./bin/www --ignore public/", "start": "node ./bin/www", "lint": "eslint ./app.js routes", - "format": "eslint --fix . bin --ignore public node_modules" + "format": "eslint --fix . bin --ignore public node_modules", + "test:integration": "jest test/integration", + "test:integration:watch": "jest test/integration --watch" }, "engines": { "node": ">=8.4.0" @@ -30,7 +32,10 @@ "eslint-config-standard": "^6.2.1", "eslint-plugin-promise": "^3.4.2", "eslint-plugin-standard": "^2.0.1", + "jest": "^21.2.1", "nodemon": "^1.12.1", - "pug-lint": "^2.5.0" + "pug-lint": "^2.5.0", + "superagent": "^3.6.3", + "supertest": "^3.0.0" } } diff --git a/test/integration/courses.test.js b/test/integration/courses.test.js new file mode 100644 index 0000000..ba61e42 --- /dev/null +++ b/test/integration/courses.test.js @@ -0,0 +1,31 @@ +/* global describe, test, expect */ +const app = require('../../app') +const request = require('supertest') + +describe('courses', () => { + test('it should render a list of courses', () => { + return request(app).get('/courses') + .expect(200) + .then((response) => { + expect(response.text.match(/