projects
/
squeep-api-dingus
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'v2.0-dev' as v2.0.0
[squeep-api-dingus]
/
test
/
lib
/
router.js
diff --git
a/test/lib/router.js
b/test/lib/router.js
index f9a2401eba045bb3b0972acac39287a07a907a01..bcb45f2d00bbfacad8bb33c5fe593cbfce6183b5 100644
(file)
--- a/
test/lib/router.js
+++ b/
test/lib/router.js
@@
-5,8
+5,8
@@
const assert = require('assert');
const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require
const Router = require('../../lib/router');
const assert = require('assert');
const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require
const Router = require('../../lib/router');
-const PathParameter = require('../../lib/router/path-parameter')
-const { DingusError } = require('../../lib/errors');
+const PathParameter = require('../../lib/router/path-parameter')
;
+const { DingusError
, RouterNoPathError, RouterNoMethodError
} = require('../../lib/errors');
const noExpectedException = 'did not get expected exception';
const noExpectedException = 'did not get expected exception';
@@
-298,6
+298,7
@@
describe('Router', function () {
const { handler } = router.lookup(method, path, ctx);
assert.strictEqual(handler, stubHandler);
const { handler } = router.lookup(method, path, ctx);
assert.strictEqual(handler, stubHandler);
+ assert.strictEqual(ctx.matchedPath, urlPath);
});
it('does not find handler with trailing slash', function () {
router.ignoreTrailingSlash = false;
});
it('does not find handler with trailing slash', function () {
router.ignoreTrailingSlash = false;
@@
-310,8
+311,7
@@
describe('Router', function () {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
- assert(e instanceof DingusError);
- assert.strictEqual(e.message, 'NoPath');
+ assert(e instanceof RouterNoPathError);
}
});
it('finds handler', function () {
}
});
it('finds handler', function () {
@@
-352,8
+352,7
@@
describe('Router', function () {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
- assert(e instanceof DingusError);
- assert.strictEqual(e.message, 'NoMethod');
+ assert(e instanceof RouterNoMethodError);
}
});
it('does not lookup non-existent path', async function () {
}
});
it('does not lookup non-existent path', async function () {
@@
-364,8
+363,7
@@
describe('Router', function () {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
router.lookup(method, path, ctx);
assert.fail(noExpectedException);
} catch (e) {
- assert(e instanceof DingusError);
- assert.strictEqual(e.message, 'NoPath');
+ assert(e instanceof RouterNoPathError);
}
});
}
});