|
| 1 | +const assert = require('assert'); |
| 2 | +const rp = require('request-promise'); |
| 3 | +const app = require('../server/app'); |
| 4 | + |
| 5 | +describe('Feathers application tests', () => { |
| 6 | + before(function(done) { |
| 7 | + this.server = app.listen(3031); |
| 8 | + this.server.once('listening', () => done()); |
| 9 | + }); |
| 10 | + |
| 11 | + after(function(done) { |
| 12 | + this.server.close(done); |
| 13 | + }); |
| 14 | + |
| 15 | + // it('starts and shows the index page', () => { |
| 16 | + // return rp('http://localhost:3031').then(body => |
| 17 | + // assert.ok(body.indexOf('<html>') !== -1) |
| 18 | + // ); |
| 19 | + // }); |
| 20 | + |
| 21 | + //describe('404', function() { |
| 22 | + // it('shows a 404 HTML page', () => { |
| 23 | + // return rp({ |
| 24 | + // url: 'http://localhost:3031/path/to/nowhere', |
| 25 | + // headers: { |
| 26 | + // 'Accept': 'text/html' |
| 27 | + // } |
| 28 | + // }).catch(res => { |
| 29 | + // assert.equal(res.statusCode, 404); |
| 30 | + // assert.ok(res.error.indexOf('<html>') !== -1); |
| 31 | + // }); |
| 32 | + // }); |
| 33 | + |
| 34 | + // it('shows a 404 JSON error without stack trace', () => { |
| 35 | + // return rp({ |
| 36 | + // url: 'http://localhost:3031/path/to/nowhere', |
| 37 | + // json: true |
| 38 | + // }).catch(res => { |
| 39 | + // assert.equal(res.statusCode, 404); |
| 40 | + // assert.equal(res.error.code, 404); |
| 41 | + // assert.equal(res.error.message, 'Page not found'); |
| 42 | + // assert.equal(res.error.name, 'NotFound'); |
| 43 | + // }); |
| 44 | + // }); |
| 45 | + //}); |
| 46 | +}); |
0 commit comments