Skip to content

Commit

Permalink
Simplify the sanity test check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gemmaleigh committed Nov 16, 2016
1 parent 3bbbfe5 commit 49965cc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/spec/sanity-checks.js
Original file line number Diff line number Diff line change
@@ -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'))
Expand All @@ -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()
}
})
})
})

0 comments on commit 49965cc

Please sign in to comment.