Skip to content

Commit

Permalink
Merge pull request #297 from lelylan/feature/add-empty-credentials-tests
Browse files Browse the repository at this point in the history
[add-empty-credentials-tests] Add missing integration tests for empty credentials
  • Loading branch information
jonathansamines authored Jan 27, 2020
2 parents c9d38d0 + f9819d0 commit b74b1c2
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 b74b1c2

Please # to comment.