From 4c8aa03163437775226ac56dcd8159e993f96007 Mon Sep 17 00:00:00 2001 From: joelchu Date: Thu, 12 Dec 2019 20:16:10 +0800 Subject: [PATCH] verify that the JsonqlAuthorisationError error is throw correctly --- packages/koa/package.json | 2 +- packages/koa/tests/auth.test.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/koa/package.json b/packages/koa/package.json index 8aafb643..18c2d421 100644 --- a/packages/koa/package.json +++ b/packages/koa/package.json @@ -23,7 +23,7 @@ "test:jwt-auth": "DEBUG=jsonql-koa* ava ./tests/jwt-auth.test.js", "test:fail": "ava ./tests/fail.test.js", "test:contract": "DEBUG=jsonql-koa*,jsonql-contract* ava ./tests/contractWithAuth.test.js", - "test:auth": "DEBUG=jsonql* ava --verbose ./tests/auth.test.js", + "test:auth": "DEBUG=jsonql-koa:test:auth ava --verbose ./tests/auth.test.js", "test:error": "DEBUG=jsonql-koa* ava ./tests/resolverNotFound.test.js", "test:config": "DEBUG=jsonql-koa* ava ./tests/config.test.js", "test:throw": "DEBUG=jsonql-* ava ./tests/throw.test.js", diff --git a/packages/koa/tests/auth.test.js b/packages/koa/tests/auth.test.js index 5b55111a..e72c6723 100644 --- a/packages/koa/tests/auth.test.js +++ b/packages/koa/tests/auth.test.js @@ -75,8 +75,10 @@ test.serial('Should cause a JsonqlAuthorisationError if I pass the wrong usernam createQuery('login', ['body-x', myKey]) ); + debug(res.body.error) + t.is(200, res.status) - t.truthy(res.body.error) + t.is('JsonqlAuthorisationError', res.body.error.className) }) -- Gitee