mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
37 lines
929 B
JavaScript
37 lines
929 B
JavaScript
import assert from 'assert'
|
|
import request from 'request'
|
|
import app from '../src/app'
|
|
|
|
describe('Feathers application tests', function () {
|
|
before(function (done) {
|
|
this.server = app.listen(3030)
|
|
this.server.once('listening', done)
|
|
})
|
|
|
|
after(function (done) {
|
|
this.server.close(done)
|
|
})
|
|
|
|
it('starts and shows the index page', function (done) {
|
|
request('http://localhost:3030', function (err, res, body) {
|
|
assert.ok(body.indexOf('<h1>Welcome!</h1>') !== -1)
|
|
done(err)
|
|
})
|
|
})
|
|
|
|
describe('404', function () {
|
|
it('shows a 404 HTML page', function (done) {
|
|
request({
|
|
url: 'http://localhost:3030/path/to/nowhere',
|
|
headers: {
|
|
Accept: 'text/html'
|
|
}
|
|
}, function (err, res, body) {
|
|
assert.strictEqual(res.statusCode, 404)
|
|
assert.ok(body.indexOf('This page could not be found.') !== -1)
|
|
done(err)
|
|
})
|
|
})
|
|
})
|
|
})
|