tests: remove usage of should
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 9967ffb · Browse files · 6 files·+46 added−47 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+46 added−47 removed
- tests:+46 added−46 removed
- other:+0 added−1 removed
Provenance
- Commit
bc5ca05- Tree
033ee39- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
9967ffb
6 files changed+46 added−47 removed
modified:test/exports.js+10 added-11 removed
1234566781091011121320 unmodified lines343536373938394041424343444546474748495051525352545556575821 unmodified lines80818283828384858684858687'use strict'
var assert = require('assert')var express = require('../');var request = require('supertest');var should = require('should');
describe('exports', function(){ it('should expose Router', function(){ express.Router.should.be.a.Function() assert.strictEqual(typeof express.Router, 'function') })
it('should expose json middleware', function () { assert.equal(typeof express.json, 'function')20 unmodified lines assert.equal(express.urlencoded.length, 1) })
it('should expose the application prototype', function(){ express.application.set.should.be.a.Function() assert.strictEqual(typeof express.application, 'object') assert.strictEqual(typeof express.application.set, 'function') })
it('should expose the request prototype', function(){ express.request.accepts.should.be.a.Function() assert.strictEqual(typeof express.request, 'object') assert.strictEqual(typeof express.request.accepts, 'function') })
it('should expose the response prototype', function(){ express.response.send.should.be.a.Function() assert.strictEqual(typeof express.response, 'object') assert.strictEqual(typeof express.response.send, 'function') })
it('should permit modifying the .application prototype', function(){ express.application.foo = function(){ return 'bar'; }; express().foo().should.equal('bar'); assert.strictEqual(express().foo(), 'bar') })
it('should permit modifying the .request prototype', function(done){ express.request.foo = function(){ return 'bar'; };21 unmodified lines .expect('bar', done); })
it('should throw on old middlewares', function(){ var error; try { express.bodyParser; } catch (e) { error = e; } should(error).have.property('message'); error.message.should.containEql('middleware'); error.message.should.containEql('bodyParser'); assert.throws(function () { express.bodyParser() }, /Error:.*middleware.*bodyParser/) assert.throws(function () { express.limit() }, /Error:.*middleware.*limit/) })})deleted:test/mocha.opts-2 removed
1---require should2---slow 20modified:test/res.sendFile.js+10 added-13 removed
5 unmodified lines6 , request = require('supertest')7 , assert = require('assert');8 var onFinished = require('on-finished');9 var path = require('path');10-var should = require('should');10 var fixtures = path.join(__dirname, 'fixtures');11 var utils = require('./support/utils');12 13 describe('res', function(){343 unmodified lines357 var app = express();358 359 app.use(function (req, res) {360 res.sendFile(path.resolve(fixtures, 'does-not-exist'), function (err) {362- should(err).be.ok()363- err.status.should.equal(404);364- res.send('got it');361+ res.send(err ? 'got ' + err.status + ' error' : 'no error')362 });363 });364 365 request(app)369- .get('/')370- .expect(200, 'got it', done);366+ .get('/')367+ .expect(200, 'got 404 error', done)368 })369 })370 371 describe('.sendFile(path, options)', function () {163 unmodified lines535 536 app.use(function(req, res){537 res.sendfile('test/fixtures/user.html', function(err){538 assert(!res.headersSent);542- req.socket.listeners('error').should.have.length(1); // node's original handler539+ assert.strictEqual(req.socket.listeners('error').length, 1) // node's original handler540 done();541 });542 543 req.socket.emit('error', new Error('broken!'));235 unmodified lines779 next(err);780 });781 782 request(app)786- .get('/')787- .end(function(err, res){788- res.statusCode.should.equal(404);789- calls.should.equal(1);790- done();791- });783+ .get('/')784+ .expect(404, function (err) {785+ if (err) return done(err)786+ assert.strictEqual(calls, 1)787+ done()788+ })789 })790 791 describe('with non-GET', function(){792 it('should still serve', function(done){48 unmodified linesmodified:test/Route.js+17 added-17 removed
1 'use strict'2 3 var after = require('after');4-var should = require('should');4+var assert = require('assert')5 var express = require('../')6 , Route = express.Route7 , methods = require('methods')8 15 unmodified lines24 });25 26 route.dispatch(req, {}, function (err) {27 if (err) return done(err);28- should(req.called).be.ok()28+ assert.ok(req.called)29 done();30 });31 })32 1 unmodified line34 var count = 0;35 var route = new Route('/foo');36 var cb = after(methods.length, function (err) {37 if (err) return done(err);38- count.should.equal(methods.length);38+ assert.strictEqual(count, methods.length)39 done();40 });41 42 route.all(function(req, res, next) {22 unmodified lines65 });66 67 route.dispatch(req, {}, function (err) {68 if (err) return done(err);69- req.count.should.equal(2);69+ assert.strictEqual(req.count, 2)70 done();71 });72 })73 })9 unmodified lines83 })84 85 route.dispatch(req, {}, function (err) {86 if (err) return done(err);87- should(req.called).be.ok()87+ assert.ok(req.called)88 done();89 });90 })91 11 unmodified lines103 })104 105 route.dispatch(req, {}, function (err) {106 if (err) return done(err);107- should(req.called).be.true()107+ assert.ok(req.called)108 done();109 });110 })111 17 unmodified lines129 })130 131 route.dispatch(req, {}, function (err) {132 if (err) return done(err);133- req.order.should.equal('abc');133+ assert.strictEqual(req.order, 'abc')134 done();135 });136 })137 })17 unmodified lines155 next(err);156 });157 158 route.dispatch(req, {}, function (err) {159- should(err).be.ok()160- should(err.message).equal('foobar');161- req.order.should.equal('a');159+ assert.ok(err)160+ assert.strictEqual(err.message, 'foobar')161+ assert.strictEqual(req.order, 'a')162 done();163 });164 })165 15 unmodified lines181 next(err);182 });183 184 route.dispatch(req, {}, function (err) {185- should(err).be.ok()186- should(err.message).equal('foobar');187- req.order.should.equal('a');185+ assert.ok(err)186+ assert.strictEqual(err.message, 'foobar')187+ assert.strictEqual(req.order, 'a')188 done();189 });190 });191 15 unmodified lines207 });208 209 route.dispatch(req, {}, function (err) {210 if (err) return done(err);211- should(req.message).equal('oops');211+ assert.strictEqual(req.message, 'oops')212 done();213 });214 });215 5 unmodified lines221 throw new Error('boom!');222 });223 224 route.dispatch(req, {}, function(err){225- should(err).be.ok()226- err.message.should.equal('boom!');225+ assert.ok(err)226+ assert.strictEqual(err.message, 'boom!')227 done();228 });229 });230 2 unmodified lines233 var route = new Route('');234 235 route.all(function(err, req, res, next){236 // this should not execute237- true.should.be.false()237+ throw new Error('should not be called')238 });239 240 route.dispatch(req, {}, done);241 });2 unmodified linesmodified:test/utils.js+9 added-3 removed
12345567880 unmodified lines89909192949593949596979899100101102103'use strict'
var assert = require('assert');var Buffer = require('safe-buffer').Buffervar should = require('should')var utils = require('../lib/utils');
describe('utils.etag(body, encoding)', function(){ it('should support strings', function(){80 unmodified lines
describe('utils.flatten(arr)', function(){ it('should flatten an array', function(){ var arr = ['one', ['two', ['three', 'four'], 'five']]; should(utils.flatten(arr)) .eql(['one', 'two', 'three', 'four', 'five']) var flat = utils.flatten(arr)
assert.strictEqual(flat.length, 5) assert.strictEqual(flat[0], 'one') assert.strictEqual(flat[1], 'two') assert.strictEqual(flat[2], 'three') assert.strictEqual(flat[3], 'four') assert.strictEqual(flat[4], 'five') assert.ok(flat.every(function (v) { return typeof v === 'string' })) })})modified:package.json-1 removed
74 unmodified lines75 "multiparty": "4.2.3",76 "nyc": "15.1.0",77 "pbkdf2-password": "1.2.1",78 "resolve-path": "1.4.0",79- "should": "13.2.3",79 "supertest": "6.2.2",80 "vhost": "~3.0.2"81 },82 "engines": {17 unmodified lines