Skip to content

Commit

Permalink
[add-empty-credentials-tests] Add integration tests for empty and non…
Browse files Browse the repository at this point in the history
… visual characteres credentials
  • Loading branch information
jonathansamines committed Jan 27, 2020
1 parent c9d38d0 commit f9819d0
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

0 comments on commit f9819d0

Please # to comment.