Skip to content

Commit

Permalink
Fix tests running without token
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcanessa committed Jan 16, 2018
1 parent 4c52f3e commit ca7e942
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
14 changes: 10 additions & 4 deletions test/GitHubInfo.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { assert } from 'chai';
import GitHubInfo from '../lib/src/GitHubInfo';

const TOKEN = process.env.GREN_GITHUB_TOKEN;

if (!TOKEN) {
console.log(chalk.blue('Token not present, skipping Gren tests.'));
describe = describe.skip;
}

describe('GitHubInfo', () => {
let githubInfo;

Expand All @@ -20,7 +27,7 @@ describe('GitHubInfo', () => {
assert.deepEqual(repo, 'github-release-notes', 'Get the repository name from repo\'s folder');
});

if (process.env.GREN_GITHUB_TOKEN) {
if (TOKEN) {
githubInfo.token.then(({ token }) => {
assert.isOk(token);
});
Expand All @@ -30,10 +37,9 @@ describe('GitHubInfo', () => {
assert.isOk(options[0].repo);
assert.isOk(options[0].username);

if (process.env.GREN_GITHUB_TOKEN) {
if (TOKEN) {
assert.isOk(options[1].token);
}
});

});
})
});
14 changes: 9 additions & 5 deletions test/Gren.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ if (!TOKEN) {
}

describe('Gren', () => {
const gren = new Gren({
token: TOKEN,
username: 'github-tools',
repo: 'github-release-notes',
quiet: true
let gren;

before(() => {
gren = new Gren({
token: TOKEN,
username: 'github-tools',
repo: 'github-release-notes',
quiet: true
});
});

it('Should throw an error', () => {
Expand Down

0 comments on commit ca7e942

Please sign in to comment.