tests: fix incorrect should usage

closes #3387
This commit is contained in:
Daniel Walasek 2017-08-05 12:42:45 +02:00 committed by Douglas Christopher Wilson
parent e0aa8bf74e
commit 713d2aed93
13 changed files with 51 additions and 51 deletions

View File

@ -25,7 +25,7 @@ describe('Route', function(){
route.dispatch(req, {}, function (err) { route.dispatch(req, {}, function (err) {
if (err) return done(err); if (err) return done(err);
should(req.called).be.ok; should(req.called).be.ok()
done(); done();
}); });
}) })
@ -84,7 +84,7 @@ describe('Route', function(){
route.dispatch(req, {}, function (err) { route.dispatch(req, {}, function (err) {
if (err) return done(err); if (err) return done(err);
should(req.called).be.ok; should(req.called).be.ok()
done(); done();
}); });
}) })
@ -104,7 +104,7 @@ describe('Route', function(){
route.dispatch(req, {}, function (err) { route.dispatch(req, {}, function (err) {
if (err) return done(err); if (err) return done(err);
should(req.called).be.true; should(req.called).be.true()
done(); done();
}); });
}) })
@ -156,7 +156,7 @@ describe('Route', function(){
}); });
route.dispatch(req, {}, function (err) { route.dispatch(req, {}, function (err) {
should(err).be.ok; should(err).be.ok()
should(err.message).equal('foobar'); should(err.message).equal('foobar');
req.order.should.equal('a'); req.order.should.equal('a');
done(); done();
@ -182,7 +182,7 @@ describe('Route', function(){
}); });
route.dispatch(req, {}, function (err) { route.dispatch(req, {}, function (err) {
should(err).be.ok; should(err).be.ok()
should(err.message).equal('foobar'); should(err.message).equal('foobar');
req.order.should.equal('a'); req.order.should.equal('a');
done(); done();
@ -222,7 +222,7 @@ describe('Route', function(){
}); });
route.dispatch(req, {}, function(err){ route.dispatch(req, {}, function(err){
should(err).be.ok; should(err).be.ok()
err.message.should.equal('boom!'); err.message.should.equal('boom!');
done(); done();
}); });
@ -234,7 +234,7 @@ describe('Route', function(){
route.all(function(err, req, res, next){ route.all(function(err, req, res, next){
// this should not execute // this should not execute
true.should.be.false; true.should.be.false()
}); });
route.dispatch(req, {}, done); route.dispatch(req, {}, done);

View File

@ -47,7 +47,7 @@ describe('Router', function(){
var router = new Router(); var router = new Router();
router.use(function (req, res) { router.use(function (req, res) {
false.should.be.true; false.should.be.true()
}); });
router.handle({ url: '', method: 'GET' }, {}, done); router.handle({ url: '', method: 'GET' }, {}, done);

View File

@ -86,7 +86,7 @@ describe('in development', function(){
it('should disable "view cache"', function(){ it('should disable "view cache"', function(){
process.env.NODE_ENV = 'development'; process.env.NODE_ENV = 'development';
var app = express(); var app = express();
app.enabled('view cache').should.be.false; app.enabled('view cache').should.be.false()
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
}) })
}) })
@ -95,7 +95,7 @@ describe('in production', function(){
it('should enable "view cache"', function(){ it('should enable "view cache"', function(){
process.env.NODE_ENV = 'production'; process.env.NODE_ENV = 'production';
var app = express(); var app = express();
app.enabled('view cache').should.be.true; app.enabled('view cache').should.be.true()
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
}) })
}) })

View File

@ -57,13 +57,13 @@ describe('app', function(){
app.get('/post/:id', function(req, res){ app.get('/post/:id', function(req, res){
var id = req.params.id; var id = req.params.id;
id.should.be.a.Number; id.should.be.a.Number()
res.send('' + id); res.send('' + id);
}); });
app.get('/user/:uid', function(req, res){ app.get('/user/:uid', function(req, res){
var id = req.params.id; var id = req.params.id;
id.should.be.a.Number; id.should.be.a.Number()
res.send('' + id); res.send('' + id);
}); });
@ -91,7 +91,7 @@ describe('app', function(){
app.get('/user/:id', function(req, res){ app.get('/user/:id', function(req, res){
var id = req.params.id; var id = req.params.id;
id.should.be.a.Number; id.should.be.a.Number()
res.send('' + id); res.send('' + id);
}); });

View File

@ -72,7 +72,7 @@ describe('app', function(){
app.set('view', View); app.set('view', View);
app.render('something', function(err, str){ app.render('something', function(err, str){
err.should.be.ok; err.should.be.ok()
err.message.should.equal('err!'); err.message.should.equal('err!');
done(); done();
}) })

View File

@ -44,10 +44,10 @@ describe('app', function(){
d = true; d = true;
next(); next();
}, function(req, res){ }, function(req, res){
a.should.be.false; a.should.be.false()
b.should.be.true; b.should.be.true()
c.should.be.true; c.should.be.true()
d.should.be.false; d.should.be.false()
res.send(204); res.send(204);
}); });

View File

@ -5,19 +5,19 @@ var should = require('should');
describe('exports', function(){ describe('exports', function(){
it('should expose Router', function(){ it('should expose Router', function(){
express.Router.should.be.a.Function; express.Router.should.be.a.Function()
}) })
it('should expose the application prototype', function(){ it('should expose the application prototype', function(){
express.application.set.should.be.a.Function; express.application.set.should.be.a.Function()
}) })
it('should expose the request prototype', function(){ it('should expose the request prototype', function(){
express.request.accepts.should.be.a.Function; express.request.accepts.should.be.a.Function()
}) })
it('should expose the response prototype', function(){ it('should expose the response prototype', function(){
express.response.send.should.be.a.Function; express.response.send.should.be.a.Function()
}) })
it('should permit modifying the .application prototype', function(){ it('should permit modifying the .application prototype', function(){

View File

@ -8,8 +8,8 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsEncoding('gzip').should.be.ok; req.acceptsEncoding('gzip').should.be.ok()
req.acceptsEncoding('deflate').should.be.ok; req.acceptsEncoding('deflate').should.be.ok()
res.end(); res.end();
}); });
@ -23,7 +23,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsEncoding('bogus').should.not.be.ok; req.acceptsEncoding('bogus').should.not.be.ok()
res.end(); res.end();
}); });

View File

@ -8,8 +8,8 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsEncodings('gzip').should.be.ok; req.acceptsEncodings('gzip').should.be.ok()
req.acceptsEncodings('deflate').should.be.ok; req.acceptsEncodings('deflate').should.be.ok()
res.end(); res.end();
}); });
@ -23,7 +23,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsEncodings('bogus').should.not.be.ok; req.acceptsEncodings('bogus').should.not.be.ok()
res.end(); res.end();
}); });

View File

@ -8,8 +8,8 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguage('en-us').should.be.ok; req.acceptsLanguage('en-us').should.be.ok()
req.acceptsLanguage('en').should.be.ok; req.acceptsLanguage('en').should.be.ok()
res.end(); res.end();
}); });
@ -23,7 +23,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguage('es').should.not.be.ok; req.acceptsLanguage('es').should.not.be.ok()
res.end(); res.end();
}); });
@ -38,9 +38,9 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguage('en').should.be.ok; req.acceptsLanguage('en').should.be.ok()
req.acceptsLanguage('es').should.be.ok; req.acceptsLanguage('es').should.be.ok()
req.acceptsLanguage('jp').should.be.ok; req.acceptsLanguage('jp').should.be.ok()
res.end(); res.end();
}); });

View File

@ -8,8 +8,8 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguages('en-us').should.be.ok; req.acceptsLanguages('en-us').should.be.ok()
req.acceptsLanguages('en').should.be.ok; req.acceptsLanguages('en').should.be.ok()
res.end(); res.end();
}); });
@ -23,7 +23,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguages('es').should.not.be.ok; req.acceptsLanguages('es').should.not.be.ok()
res.end(); res.end();
}); });
@ -38,9 +38,9 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.acceptsLanguages('en').should.be.ok; req.acceptsLanguages('en').should.be.ok()
req.acceptsLanguages('es').should.be.ok; req.acceptsLanguages('es').should.be.ok()
req.acceptsLanguages('jp').should.be.ok; req.acceptsLanguages('jp').should.be.ok()
res.end(); res.end();
}); });

View File

@ -8,7 +8,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.xhr.should.be.true; req.xhr.should.be.true()
res.end(); res.end();
}); });
@ -25,7 +25,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.xhr.should.be.true; req.xhr.should.be.true()
res.end(); res.end();
}); });
@ -42,7 +42,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.xhr.should.be.false; req.xhr.should.be.false()
res.end(); res.end();
}); });
@ -59,7 +59,7 @@ describe('req', function(){
var app = express(); var app = express();
app.use(function(req, res){ app.use(function(req, res){
req.xhr.should.be.false; req.xhr.should.be.false()
res.end(); res.end();
}); });

View File

@ -108,7 +108,7 @@ describe('res', function(){
}); });
app.use(function (err, req, res, next) { app.use(function (err, req, res, next) {
err.code.should.be.empty; err.code.should.be.empty()
cb(); cb();
}); });
@ -224,7 +224,7 @@ describe('res', function(){
app.use(function (req, res) { app.use(function (req, res) {
setImmediate(function () { setImmediate(function () {
res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) { res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {
should(err).be.ok; should(err).be.ok()
err.code.should.equal('ECONNABORTED'); err.code.should.equal('ECONNABORTED');
cb(); cb();
}); });
@ -243,7 +243,7 @@ describe('res', function(){
app.use(function (req, res) { app.use(function (req, res) {
onFinished(res, function () { onFinished(res, function () {
res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) { res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {
should(err).be.ok; should(err).be.ok()
err.code.should.equal('ECONNABORTED'); err.code.should.equal('ECONNABORTED');
cb(); cb();
}); });
@ -294,7 +294,7 @@ describe('res', function(){
app.use(function (req, res) { app.use(function (req, res) {
res.sendFile(path.resolve(fixtures, 'does-not-exist'), function (err) { res.sendFile(path.resolve(fixtures, 'does-not-exist'), function (err) {
should(err).be.ok; should(err).be.ok()
err.status.should.equal(404); err.status.should.equal(404);
res.send('got it'); res.send('got it');
}); });
@ -348,7 +348,7 @@ describe('res', function(){
app.use(function (req, res) { app.use(function (req, res) {
setImmediate(function () { setImmediate(function () {
res.sendfile('test/fixtures/name.txt', function (err) { res.sendfile('test/fixtures/name.txt', function (err) {
should(err).be.ok; should(err).be.ok()
err.code.should.equal('ECONNABORTED'); err.code.should.equal('ECONNABORTED');
cb(); cb();
}); });
@ -367,7 +367,7 @@ describe('res', function(){
app.use(function (req, res) { app.use(function (req, res) {
onFinished(res, function () { onFinished(res, function () {
res.sendfile('test/fixtures/name.txt', function (err) { res.sendfile('test/fixtures/name.txt', function (err) {
should(err).be.ok; should(err).be.ok()
err.code.should.equal('ECONNABORTED'); err.code.should.equal('ECONNABORTED');
cb(); cb();
}); });
@ -600,7 +600,7 @@ describe('res', function(){
}); });
app.use(function (err, req, res, next) { app.use(function (err, req, res, next) {
err.code.should.be.empty; err.code.should.be.empty()
cb(); cb();
}); });