X-Git-Url: http://git.squeep.com/?p=squeep-api-dingus;a=blobdiff_plain;f=test%2Flib%2Frouter.js;fp=test%2Flib%2Frouter.js;h=bcb45f2d00bbfacad8bb33c5fe593cbfce6183b5;hp=c89cc196472a1cb6d1959126a572afb3f7789aa6;hb=031c170bdaf1d9c331e6f6fc701ce6540c0e6941;hpb=df1c89ca311a06417104e6be0ade6617cbfae60e diff --git a/test/lib/router.js b/test/lib/router.js index c89cc19..bcb45f2 100644 --- 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 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'; @@ -311,8 +311,7 @@ describe('Router', function () { 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 () { @@ -353,8 +352,7 @@ describe('Router', function () { 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 () { @@ -365,8 +363,7 @@ describe('Router', function () { router.lookup(method, path, ctx); assert.fail(noExpectedException); } catch (e) { - assert(e instanceof DingusError); - assert.strictEqual(e.message, 'NoPath'); + assert(e instanceof RouterNoPathError); } });