diff --git a/.eslintrc b/.eslintrc index 2ccbbab..11d01f9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,6 +14,5 @@ "node": true }, "extends": "eslint:recommended", - "ecmaFeatures": {}, "plugins": [] } diff --git a/lib/route-node.js b/lib/route-node.js index 2fc4cae..ece1538 100644 --- a/lib/route-node.js +++ b/lib/route-node.js @@ -8,8 +8,7 @@ var isRegExp = utils.isRegExp var isString = utils.isString var noop = utils.noop -function RouteNode (options) { - options = options || {} +function RouteNode () { this._children = Object.create(null) this._funcs = Object.create(null) this._regExs = Object.create(null) diff --git a/lib/router.js b/lib/router.js index 2603bb5..e32ffb9 100644 --- a/lib/router.js +++ b/lib/router.js @@ -10,8 +10,7 @@ var isFunction = utils.isFunction var isString = utils.isString var noop = utils.noop -function Router(options) { - options = options || {} +function Router() { this.routes = new RouteNode() } diff --git a/package.json b/package.json index a972feb..a0152d4 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ }, "homepage": "https://github.com/xbudex/routing-buddy#readme", "devDependencies": { - "eslint": "^1.10.3", - "expect": "^1.14.0", - "mocha": "^2.4.5" + "eslint": "^6.8.0", + "expect": "^25.5.0", + "mocha": "^7.1.2" } } diff --git a/test/route-node.js b/test/route-node.js index 7e0d308..30b5b56 100644 --- a/test/route-node.js +++ b/test/route-node.js @@ -3,7 +3,7 @@ var RouteNode = require('../lib/route-node') module.exports = describe('RouteNode', function () { it('→ exists', function () { - expect(new RouteNode()).toExist() + expect(new RouteNode()).not.toBeUndefined() }) describe('→ add nodes', function () { @@ -38,11 +38,11 @@ module.exports = describe('RouteNode', function () { it('→ get error callback for not found', function (done) { node.get(['fake', 'route'], [], function (err, func, cbContext, args) { - expect(err).toBeA(Error) + expect(err).toBeInstanceOf(Error) expect(err.message).toMatch(/not found/) - expect(func).toNotExist() - expect(cbContext).toNotExist() - expect(args).toNotExist() + expect(func).toBeUndefined() + expect(cbContext).toBeUndefined() + expect(args).toBeUndefined() done() }) }) diff --git a/test/router.js b/test/router.js index e5f54fe..9c54a10 100644 --- a/test/router.js +++ b/test/router.js @@ -4,7 +4,7 @@ var NotFoundError = require('../lib/error').NotFound describe('Router', function () { it('→ exists', function () { - expect(Router).toExist() + expect(Router).not.toBeUndefined() }) it('→ add root node', function (done) { @@ -31,7 +31,7 @@ describe('Router', function () { var router = new Router() router.add(['/user', /^(\d+)$/], function (number) { return number }) router.route('/user/', function (err) { - expect(err).toBeA(NotFoundError) + expect(err).toBeInstanceOf(NotFoundError) done() }) }) @@ -39,9 +39,9 @@ describe('Router', function () { it('→ get error in callback for missing handler', function (done) { var router = new Router() router.route('/some/fake/path', function (err, handlerResult) { - expect(err).toBeA(Error) + expect(err).toBeInstanceOf(Error) expect(err.message).toMatch(/not found/) - expect(handlerResult).toNotExist() + expect(handlerResult).toBeUndefined() done() }) }) @@ -62,7 +62,7 @@ describe('Router', function () { var router = new Router() router.add(['/by/id', /\d+/], function () {}) router.route('/by/id/not-an-id', function (err) { - expect(err).toBeA(NotFoundError) + expect(err).toBeInstanceOf(NotFoundError) done() }) }) @@ -85,8 +85,8 @@ describe('Router', function () { var router = new Router() router.add(['by', 'order', /(\d+)/], function (one, two, three) { expect(one).toBe('1') - expect(two).toNotExist() - expect(three).toNotExist() + expect(two).toBeUndefined() + expect(three).toBeUndefined() }) router.route('/by/order/1-2-3', function (err) { @@ -131,7 +131,7 @@ describe('Router', function () { var router = new Router() router.add(['/by/order', toInt], function () {}) router.route('/by/order/not-found', function (err) { - expect(err).toBeA(NotFoundError) + expect(err).toBeInstanceOf(NotFoundError) done() }) }) diff --git a/test/utils.js b/test/utils.js index 44f2e74..d41a8e9 100644 --- a/test/utils.js +++ b/test/utils.js @@ -16,12 +16,12 @@ SomeClass.prototype.bar = 'asdf' describe('utils', function () { it('→ exists', function () { - expect(utils).toExist() + expect(utils).not.toBeUndefined() }) describe('→ noop', function () { it('→ is a function', function () { - expect(noop).toBeA(Function) + expect(noop).toBeInstanceOf(Function) }) })