error-pages.js
This file
Path
test/acceptance/error-pages.js
102 lines · 2.3 KiB · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 1–102why, one step back12var app = require('../../examples/error-pages')3 , request = require('supertest');45describe('error-pages', function(){6 describe('GET /', function(){7 it('should respond with page list', function(done){8 request(app)9 .get('/')10 .expect(/Pages Example/, done)11 })12 })1314 describe('Accept: text/html',function(){15 describe('GET /403', function(){16 it('should respond with 403', function(done){17 request(app)18 .get('/403')19 .expect(403, done)20 })21 })2223 describe('GET /404', function(){24 it('should respond with 404', function(done){25 request(app)26 .get('/404')27 .expect(404, done)28 })29 })3031 describe('GET /500', function(){32 it('should respond with 500', function(done){33 request(app)34 .get('/500')35 .expect(500, done)36 })37 })38 })3940 describe('Accept: application/json',function(){41 describe('GET /403', function(){42 it('should respond with 403', function(done){43 request(app)44 .get('/403')45 .set('Accept','application/json')46 .expect(403, done)47 })48 })4950 describe('GET /404', function(){51 it('should respond with 404', function(done){52 request(app)53 .get('/404')54 .set('Accept','application/json')55 .end(function(err, res){56 res.body.should.eql({ error: 'Not found' });57 done()58 })59 })60 })6162 describe('GET /500', function(){63 it('should respond with 500', function(done){64 request(app)65 .get('/500')66 .set('Accept', 'application/json')67 .expect(500, done)68 })69 })70 })717273 describe('Accept: text/plain',function(){74 describe('GET /403', function(){75 it('should respond with 403', function(done){76 request(app)77 .get('/403')78 .set('Accept','text/plain')79 .expect(403, done)80 })81 })8283 describe('GET /404', function(){84 it('should respond with 404', function(done){85 request(app)86 .get('/404')87 .set('Accept', 'text/plain')88 .expect(404)89 .expect('Not found', done);90 })91 })9293 describe('GET /500', function(){94 it('should respond with 500', function(done){95 request(app)96 .get('/500')97 .set('Accept','text/plain')98 .expect(500, done)99 })100 })101 })102})