update dependencies
This commit is contained in:
parent
47c65ad9c7
commit
19a206bf1e
@ -14,6 +14,5 @@
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"ecmaFeatures": {},
|
||||
"plugins": []
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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()
|
||||
}
|
||||
|
||||
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user