deps: should@~4.0.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent b49453c · Browse files · 8 files·+49 added−71 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+49 added−71 removed
- tests:+42 added−66 removed
- other:+7 added−5 removed
Provenance
- Commit
1f2e00e- Tree
3fad31b- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
b49453c
8 files changed+49 added−71 removed
modified:examples/resource/app.js+5 added-3 removed
16 unmodified lines1718192021212223242526272814 unmodified lines434445464445474849505143 unmodified lines16 unmodified lines , format = req.params.format; obj.range(req, res, a, b, format); }); this.get(path + '/:id', obj.show); this.delete(path + '/:id', obj.destroy); this.delete(path + '/:id', function(req, res){ var id = parseInt(req.params.id, 10); obj.destroy(req, res, id); });};
// Fake records
14 unmodified lines }, show: function(req, res){ res.send(users[req.params.id] || { error: 'Cannot find user' }); }, destroy: function(req, res){ var id = req.params.id; destroy: function(req, res, id){ var destroyed = id in users; delete users[id]; res.send(destroyed ? 'destroyed' : 'Cannot find user'); },43 unmodified linesmodified:test/acceptance/ejs.js+6 added-9 removed
5 unmodified lines678910111213141516171011121314151620175 unmodified lines describe('GET /', function(){ it('should respond with html', function(done){ request(app) .get('/') .end(function(err, res){ res.should.have.status(200); res.should.have.header('Content-Type', 'text/html; charset=utf-8'); res.text.should.include('<li>tobi <tobi@learnboost.com></li>'); res.text.should.include('<li>loki <loki@learnboost.com></li>'); res.text.should.include('<li>jane <jane@learnboost.com></li>'); done(); }); .expect('Content-Type', 'text/html; charset=utf-8') .expect(/<li>tobi <tobi@learnboost\.com><\/li>/) .expect(/<li>loki <loki@learnboost\.com><\/li>/) .expect(/<li>jane <jane@learnboost\.com><\/li>/) .expect(200, done) }) })})No newline at end of file})modified:test/acceptance/mvc.js+10 added-17 removed
45 unmodified lines46 describe('GET /users', function(){47 it('should display a list of users', function(done){48 request(app)49 .get('/users')50- .end(function(err, res){51- res.text.should.include('<h1>Users</h1>');52- res.text.should.include('>TJ<');53- res.text.should.include('>Guillermo<');54- res.text.should.include('>Nathan<');55- done();56- })50+ .expect(/<h1>Users<\/h1>/)51+ .expect(/>TJ</)52+ .expect(/>Guillermo</)53+ .expect(/>Nathan</)54+ .expect(200, done)55 })56 })57 58 describe('GET /user/:id', function(){59 describe('when present', function(){60 it('should display the user', function(done){61 request(app)62 .get('/user/0')65- .end(function(err, res){66- res.text.should.include('<h1>TJ <a href="/user/0/edit">edit');67- done();68- })63+ .expect(200, /<h1>TJ <a href="\/user\/0\/edit">edit/, done)64 })65 66 it('should display the users pets', function(done){67 request(app)68 .get('/user/0')74- .end(function(err, res){75- res.text.should.include('/pet/0">Tobi');76- res.text.should.include('/pet/1">Loki');77- res.text.should.include('/pet/2">Jane');78- done();79- })69+ .expect(/\/pet\/0">Tobi/)70+ .expect(/\/pet\/1">Loki/)71+ .expect(/\/pet\/2">Jane/)72+ .expect(200, done)73 })74 })75 76 describe('when not present', function(){46 unmodified linesmodified:test/acceptance/web-service.js+2 added-6 removed
96 unmodified lines97 describe('when requesting an invalid route', function(){98 it('should respond with 404 json', function(done){99 request(app)100 .get('/api/something?api-key=bar')101- .end(function(err, res){102- res.should.have.status(404);103- res.should.be.json;104- res.text.should.equal('{"error":"Lame, can\'t find that"}');105- done();106- });101+ .expect('Content-Type', /json/)102+ .expect(404, '{"error":"Lame, can\'t find that"}', done)103 })104 })105 })modified:test/res.cookie.js+2 added-5 removed
87 unmodified lines88 89 request(app)90 .get('/')91 .end(function(err, res){92- res.headers['set-cookie'][0].should.not.include('Thu, 01 Jan 1970 00:00:01 GMT');92+ res.headers['set-cookie'][0].should.not.containEql('Thu, 01 Jan 1970 00:00:01 GMT');93 done();94 })95 })96 6 unmodified lines103 });104 105 request(app)106 .get('/')107- .end(function(err, res){108- res.headers['set-cookie'][0].should.include('Max-Age=1');109- done();110- })107+ .expect('Set-Cookie', /Max-Age=1/, done)108 })109 110 it('should not mutate the options object', function(done){111 var app = express();60 unmodified linesmodified:test/res.download.js+16 added-19 removed
12 unmodified lines13 });14 15 request(app)16 .get('/')17- .end(function(err, res){18- res.should.have.header('Content-Type', 'text/html; charset=UTF-8');19- res.should.have.header('Content-Disposition', 'attachment; filename="user.html"');20- res.text.should.equal('<p>{{user.name}}</p>');21- done();22- });17+ .expect('Content-Type', 'text/html; charset=UTF-8')18+ .expect('Content-Disposition', 'attachment; filename="user.html"')19+ .expect(200, '<p>{{user.name}}</p>', done)20 })21 })22 23 describe('.download(path, filename)', function(){5 unmodified lines29 });30 31 request(app)32 .get('/')36- .end(function(err, res){37- res.should.have.header('Content-Type', 'text/html; charset=UTF-8');38- res.should.have.header('Content-Disposition', 'attachment; filename="document"');39- done();40- });33+ .expect('Content-Type', 'text/html; charset=UTF-8')34+ .expect('Content-Disposition', 'attachment; filename="document"')35+ .expect(200, done)36 })37 })38 39 describe('.download(path, fn)', function(){6 unmodified lines46 });47 48 request(app)49 .get('/')55- .end(function(err, res){56- res.should.have.header('Content-Type', 'text/html; charset=UTF-8');57- res.should.have.header('Content-Disposition', 'attachment; filename="user.html"');58- });50+ .expect('Content-Type', 'text/html; charset=UTF-8')51+ .expect('Content-Disposition', 'attachment; filename="user.html"')52+ .expect(200, function(err){53+ assert.ifError(err)54+ })55 })56 })57 58 describe('.download(path, filename, fn)', function(){6 unmodified lines65 });66 67 request(app)68 .get('/')73- .end(function(err, res){74- res.should.have.header('Content-Type', 'text/html; charset=UTF-8');75- res.should.have.header('Content-Disposition', 'attachment; filename="document"');76- });69+ .expect('Content-Type', 'text/html; charset=UTF-8')70+ .expect('Content-Disposition', 'attachment; filename="document"')71+ .expect(200, function(err){72+ assert.ifError(err)73+ })74 })75 })76 77 describe('on failure', function(){38 unmodified linesmodified:test/res.redirect.js+6 added-10 removed
11 unmodified lines12 });13 14 request(app)15 .get('/')16- .end(function(err, res){17- res.statusCode.should.equal(302);18- res.headers.should.have.property('location', 'http://google.com');19- done();20- })16+ .expect('location', 'http://google.com')17+ .expect(302, done)18 })19 })20 21 describe('.redirect(status, url)', function(){133 unmodified lines155 156 request(app)157 .get('/')158 .set('Accept', 'application/octet-stream')162- .end(function(err, res){163- res.should.have.status(302);164- res.headers.should.have.property('location', 'http://google.com');159+ .expect('location', 'http://google.com')160+ .expect('content-length', '0')161+ .expect(302, '', function(err, res){162+ if (err) return done(err)163 res.headers.should.not.have.property('content-type');166- res.headers.should.have.property('content-length', '0');167- res.text.should.equal('');164 done();165 })166 })167 })73 unmodified linesmodified:package.json+2 added-2 removed
63 unmodified lines64 },65 "devDependencies": {66 "ejs": "~0.8.4",67 "istanbul": "0.2.10",68- "mocha": "~1.19.0",69- "should": "~3.3.1",68+ "mocha": "~1.20.0",69+ "should": "~4.0.0",70 "jade": "~0.30.0",71 "hjs": "~0.0.6",72 "stylus": "~0.40.0",73 "connect-redis": "~1.4.5",16 unmodified lines