From f9819d0d9f1ea72e535dda81e9da8108ee73b93a Mon Sep 17 00:00:00 2001 From: Jonathan Samines Date: Mon, 27 Jan 2020 08:45:57 -0600 Subject: [PATCH] [add-empty-credentials-tests] Add integration tests for empty and non visual characteres credentials --- test/index.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/test/index.js b/test/index.js index 4405b738..a396a58d 100644 --- a/test/index.js +++ b/test/index.js @@ -6,14 +6,33 @@ const oauth2Module = require('./../index.js'); const { createModuleConfig } = require('./_module-config'); test('@create => throws a validation error when no configuration is provided', (t) => { - const createModule = () => oauth2Module.create(); - - t.throws(createModule); + t.throws(() => oauth2Module.create()); }); -test('@create => creates a new instance', (t) => { +test('@create => creates a new instance with the minimal required configuration', (t) => { const config = createModuleConfig(); - const createModule = () => oauth2Module.create(config); - t.notThrows(createModule); + t.notThrows(() => oauth2Module.create(config)); +}); + +test('@create => creates a new instance with empty credentials', (t) => { + const config = createModuleConfig({ + client: { + id: '', + secret: '', + }, + }); + + t.notThrows(() => oauth2Module.create(config)); +}); + +test('@create => creates a new instance with visual non-control characters', (t) => { + const config = createModuleConfig({ + client: { + id: '\x20hello\x7E', + secret: '\x20world\x7E', + }, + }); + + t.notThrows(() => oauth2Module.create(config)); });