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)); });