Skip to content
Myr

tests: fix incorrect should usage

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #3387

authored by Daniel Walasek · committed by Douglas Christopher Wilson · parent e0aa8bf · Browse files · 13 files+51 added−51 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

13 files+51 added−51 removed

  • tests:+51 added−51 removed

13 files+51 added−51 removed

modified:test/app.js+2 added-2 removed
modified:test/app.param.js+3 added-3 removed
55 unmodified lines
56 });5758 app.get('/post/:id', function(req, res){59 var id = req.params.id;60 id.should.be.a.Number;60 id.should.be.a.Number()61 res.send('' + id);62 });6364 app.get('/user/:uid', function(req, res){65 var id = req.params.id;66 id.should.be.a.Number;66 id.should.be.a.Number()67 res.send('' + id);68 });6970 request(app)
19 unmodified lines
90 });9192 app.get('/user/:id', function(req, res){93 var id = req.params.id;94 id.should.be.a.Number;94 id.should.be.a.Number()95 res.send('' + id);96 });9798 request(app)
268 unmodified lines
modified:test/app.render.js+1 added-1 removed
70 unmodified lines
7172 app.set('view', View);7374 app.render('something', function(err, str){75 err.should.be.ok;75 err.should.be.ok()76 err.message.should.equal('err!');77 done();78 })79 })
296 unmodified lines
modified:test/app.routes.error.js+4 added-4 removed
modified:test/exports.js+4 added-4 removed
3 unmodified lines
4var should = require('should');56describe('exports', function(){7 it('should expose Router', function(){8 express.Router.should.be.a.Function;8 express.Router.should.be.a.Function()9 })1011 it('should expose the application prototype', function(){12 express.application.set.should.be.a.Function;12 express.application.set.should.be.a.Function()13 })1415 it('should expose the request prototype', function(){16 express.request.accepts.should.be.a.Function;16 express.request.accepts.should.be.a.Function()17 })1819 it('should expose the response prototype', function(){20 express.response.send.should.be.a.Function;20 express.response.send.should.be.a.Function()21 })2223 it('should permit modifying the .application prototype', function(){24 express.application.foo = function(){ return 'bar'; };
37 unmodified lines
modified:test/req.acceptsEncoding.js+3 added-3 removed
6 unmodified lines
7 it('should be true if encoding accepted', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptsEncoding('gzip').should.be.ok;12 req.acceptsEncoding('deflate').should.be.ok;11 req.acceptsEncoding('gzip').should.be.ok()12 req.acceptsEncoding('deflate').should.be.ok()13 res.end();14 });1516 request(app)
5 unmodified lines
22 it('should be false if encoding not accepted', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptsEncoding('bogus').should.not.be.ok;26 req.acceptsEncoding('bogus').should.not.be.ok()27 res.end();28 });2930 request(app)
6 unmodified lines
modified:test/req.acceptsEncodings.js+3 added-3 removed
6 unmodified lines
7 it('should be true if encoding accepted', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptsEncodings('gzip').should.be.ok;12 req.acceptsEncodings('deflate').should.be.ok;11 req.acceptsEncodings('gzip').should.be.ok()12 req.acceptsEncodings('deflate').should.be.ok()13 res.end();14 });1516 request(app)
5 unmodified lines
22 it('should be false if encoding not accepted', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptsEncodings('bogus').should.not.be.ok;26 req.acceptsEncodings('bogus').should.not.be.ok()27 res.end();28 });2930 request(app)
6 unmodified lines
modified:test/req.acceptsLanguage.js+6 added-6 removed
6 unmodified lines
7 it('should be true if language accepted', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptsLanguage('en-us').should.be.ok;12 req.acceptsLanguage('en').should.be.ok;11 req.acceptsLanguage('en-us').should.be.ok()12 req.acceptsLanguage('en').should.be.ok()13 res.end();14 });1516 request(app)
5 unmodified lines
22 it('should be false if language not accepted', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptsLanguage('es').should.not.be.ok;26 req.acceptsLanguage('es').should.not.be.ok()27 res.end();28 });2930 request(app)
6 unmodified lines
37 it('should always return true', function(done){38 var app = express();3940 app.use(function(req, res){41 req.acceptsLanguage('en').should.be.ok;42 req.acceptsLanguage('es').should.be.ok;43 req.acceptsLanguage('jp').should.be.ok;41 req.acceptsLanguage('en').should.be.ok()42 req.acceptsLanguage('es').should.be.ok()43 req.acceptsLanguage('jp').should.be.ok()44 res.end();45 });4647 request(app)
6 unmodified lines
modified:test/req.acceptsLanguages.js+6 added-6 removed
6 unmodified lines
7 it('should be true if language accepted', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptsLanguages('en-us').should.be.ok;12 req.acceptsLanguages('en').should.be.ok;11 req.acceptsLanguages('en-us').should.be.ok()12 req.acceptsLanguages('en').should.be.ok()13 res.end();14 });1516 request(app)
5 unmodified lines
22 it('should be false if language not accepted', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptsLanguages('es').should.not.be.ok;26 req.acceptsLanguages('es').should.not.be.ok()27 res.end();28 });2930 request(app)
6 unmodified lines
37 it('should always return true', function(done){38 var app = express();3940 app.use(function(req, res){41 req.acceptsLanguages('en').should.be.ok;42 req.acceptsLanguages('es').should.be.ok;43 req.acceptsLanguages('jp').should.be.ok;41 req.acceptsLanguages('en').should.be.ok()42 req.acceptsLanguages('es').should.be.ok()43 req.acceptsLanguages('jp').should.be.ok()44 res.end();45 });4647 request(app)
6 unmodified lines
modified:test/req.xhr.js+4 added-4 removed
6 unmodified lines
7 it('should return true when X-Requested-With is xmlhttprequest', function(done){8 var app = express();910 app.use(function(req, res){11 req.xhr.should.be.true;11 req.xhr.should.be.true()12 res.end();13 });1415 request(app)
8 unmodified lines
24 it('should case-insensitive', function(done){25 var app = express();2627 app.use(function(req, res){28 req.xhr.should.be.true;28 req.xhr.should.be.true()29 res.end();30 });3132 request(app)
8 unmodified lines
41 it('should return false otherwise', function(done){42 var app = express();4344 app.use(function(req, res){45 req.xhr.should.be.false;45 req.xhr.should.be.false()46 res.end();47 });4849 request(app)
8 unmodified lines
58 it('should return false when not present', function(done){59 var app = express();6061 app.use(function(req, res){62 req.xhr.should.be.false;62 req.xhr.should.be.false()63 res.end();64 });6566 request(app)
8 unmodified lines
modified:test/res.sendFile.js+7 added-7 removed
106 unmodified lines
107 test.abort();108 });109110 app.use(function (err, req, res, next) {111 err.code.should.be.empty;111 err.code.should.be.empty()112 cb();113 });114115 var test = request(app).get('/');
107 unmodified lines
223224 app.use(function (req, res) {225 setImmediate(function () {226 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {227 should(err).be.ok;227 should(err).be.ok()228 err.code.should.equal('ECONNABORTED');229 cb();230 });231 });
10 unmodified lines
242243 app.use(function (req, res) {244 onFinished(res, function () {245 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {246 should(err).be.ok;246 should(err).be.ok()247 err.code.should.equal('ECONNABORTED');248 cb();249 });250 });
42 unmodified lines
293 var app = express();294295 app.use(function (req, res) {296 res.sendFile(path.resolve(fixtures, 'does-not-exist'), function (err) {297 should(err).be.ok;297 should(err).be.ok()298 err.status.should.equal(404);299 res.send('got it');300 });301 });
45 unmodified lines
347348 app.use(function (req, res) {349 setImmediate(function () {350 res.sendfile('test/fixtures/name.txt', function (err) {351 should(err).be.ok;351 should(err).be.ok()352 err.code.should.equal('ECONNABORTED');353 cb();354 });355 });
10 unmodified lines
366367 app.use(function (req, res) {368 onFinished(res, function () {369 res.sendfile('test/fixtures/name.txt', function (err) {370 should(err).be.ok;370 should(err).be.ok()371 err.code.should.equal('ECONNABORTED');372 cb();373 });374 });
224 unmodified lines
599 test.abort();600 });601602 app.use(function (err, req, res, next) {603 err.code.should.be.empty;603 err.code.should.be.empty()604 cb();605 });606607 var test = request(app).get('/');
148 unmodified lines
modified:test/Route.js+7 added-7 removed
23 unmodified lines
24 });2526 route.dispatch(req, {}, function (err) {27 if (err) return done(err);28 should(req.called).be.ok;28 should(req.called).be.ok()29 done();30 });31 })32
50 unmodified lines
83 })8485 route.dispatch(req, {}, function (err) {86 if (err) return done(err);87 should(req.called).be.ok;87 should(req.called).be.ok()88 done();89 });90 })91
11 unmodified lines
103 })104105 route.dispatch(req, {}, function (err) {106 if (err) return done(err);107 should(req.called).be.true;107 should(req.called).be.true()108 done();109 });110 })111
43 unmodified lines
155 next(err);156 });157158 route.dispatch(req, {}, function (err) {159 should(err).be.ok;159 should(err).be.ok()160 should(err.message).equal('foobar');161 req.order.should.equal('a');162 done();163 });
17 unmodified lines
181 next(err);182 });183184 route.dispatch(req, {}, function (err) {185 should(err).be.ok;185 should(err).be.ok()186 should(err.message).equal('foobar');187 req.order.should.equal('a');188 done();189 });
31 unmodified lines
221 throw new Error('boom!');222 });223224 route.dispatch(req, {}, function(err){225 should(err).be.ok;225 should(err).be.ok()226 err.message.should.equal('boom!');227 done();228 });229 });
3 unmodified lines
233 var route = new Route('');234235 route.all(function(err, req, res, next){236 // this should not execute237 true.should.be.false;237 true.should.be.false()238 });239240 route.dispatch(req, {}, done);241 });
2 unmodified lines
modified:test/Router.js+1 added-1 removed
45 unmodified lines
46 it('should handle blank URL', function(done){47 var router = new Router();4849 router.use(function (req, res) {50 false.should.be.true;50 false.should.be.true()51 });5253 router.handle({ url: '', method: 'GET' }, {}, done);54 });
497 unmodified lines