forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGitHubInfo.spec.js
More file actions
39 lines (31 loc) · 1.14 KB
/
GitHubInfo.spec.js
File metadata and controls
39 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { assert } from 'chai';
import GitHubInfo from '../lib/src/GitHubInfo';
describe('GitHubInfo', () => {
let githubInfo;
beforeEach(() => {
githubInfo = new GitHubInfo();
});
it('Should execute the commands', done => {
githubInfo._executeCommand('echo "gren"', text => {
assert.deepEqual(text, 'gren', 'Returns the text echoed');
}).then(done);
});
it('Should get repo and token informations', () => {
githubInfo.repo.then(({ username, repo }) => {
assert.deepEqual(username, 'github-tools', 'Get username from repo\'s folder');
assert.deepEqual(repo, 'github-release-notes', 'Get the repository name from repo\'s folder');
});
if (process.env.GREN_GITHUB_TOKEN) {
githubInfo.token.then(({ token }) => {
assert.isOk(token);
});
}
githubInfo.options.then(options => {
assert.isOk(options[0].repo);
assert.isOk(options[0].username);
if (process.env.GREN_GITHUB_TOKEN) {
assert.isOk(options[1].token);
}
});
});
})