From 49965cc87d2f9ebf8ce7b0601845533b4721ecff Mon Sep 17 00:00:00 2001 From: Gemma Leigh Date: Wed, 16 Nov 2016 12:49:28 +0000 Subject: [PATCH] Simplify the sanity test check App doesn't need to listen in the test script as supertest accepts the app variable and handles the listening and un-listening itself. This also removes the needs for the after block to stop the server. --- test/spec/sanity-checks.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test/spec/sanity-checks.js b/test/spec/sanity-checks.js index d377806355..397087bc32 100644 --- a/test/spec/sanity-checks.js +++ b/test/spec/sanity-checks.js @@ -1,20 +1,14 @@ -/* global describe, it, before */ +/* eslint-env mocha */ var request = require('supertest') -var assert = require('assert') +var app = require('../../server.js') var path = require('path') var fs = require('fs') +var assert = require('assert') /** * Basic sanity checks on the dev server */ describe('The prototype kit', function () { - var app - - before(function (done) { - app = require('../../server') - done() - }) - it('should generate assets into the /public folder', function () { assert.doesNotThrow(function () { fs.accessSync(path.resolve(__dirname, '../../public/javascripts/application.js')) @@ -27,6 +21,13 @@ describe('The prototype kit', function () { request(app) .get('/') .expect('Content-Type', /text\/html/) - .expect(200, done) + .expect(200) + .end(function (err, res) { + if (err) { + done(err) + } else { + done() + } + }) }) })