Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

cleanup-from-eslint #60

Merged
merged 2 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/githubWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const GitHubApi = require('github'),
exec = require('child_process').exec,
inquirer = require('./inquirerWrapper'),
InquirerQuestionBuilder = require('./inquirerQuestionBuilder'),
GITHUB_REMOTE_REGEXP = /github\.com(?::|\/)([^\/]+)\/([^\/]+?)(?:\.git)? \(fetch\)$/;
GITHUB_REMOTE_REGEXP = /github\.com(?::|\/)([^/]+)\/([^/]+?)(?:\.git)? \(fetch\)$/;

let wrapper = {
ghApi: () => github,
Expand Down
2 changes: 1 addition & 1 deletion src/parseHubIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function parseHubIssues(rawIssues) {
return aNum - bNum;
});
var formatted = _.map(sorted, function(i) {
return i.trim().replace(/(\d+)]([^\(]+)/, '#$1 [$2]');
return i.trim().replace(/(\d+)]([^(]+)/, '#$1 [$2]');
});
var issuesAndPullRequests = _.filter(formatted, function(i) {
return i.length > 0;
Expand Down
35 changes: 18 additions & 17 deletions test/githubWrapperTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,30 @@ describe('githubwrapper.js Tests', function() {
it('authenticate should use token type auth when username is `<token>`', (done) => {
const password = 'thisisanapitoken';
sandbox.stub(inquirer, 'prompt').resolves({username: '<token>', password});
gitHubWrapper.authenticate().then(() => {
expect(mockGithub.authenticate.calledOnce).to.be.true;
expect(mockGithub.authenticate.args[0][0]).to.eql({type: 'token', token: password});
done();
})
.catch(e => {
done(e);
});
gitHubWrapper.authenticate()
.then(() => {
expect(mockGithub.authenticate.calledOnce).to.be.true;
expect(mockGithub.authenticate.args[0][0]).to.eql({type: 'token', token: password});
done();
})
.catch(e => {
done(e);
});
});

it('authenticate should use basic type auth when username is anything except `<token>`', (done) => {
const password = 'this is some password';
const username = 'not-token';
sandbox.stub(inquirer, 'prompt').resolves({username, password});
gitHubWrapper.authenticate().then(() => {

expect(mockGithub.authenticate.calledOnce).to.be.true;
expect(mockGithub.authenticate.args[0][0]).to.eql({type: 'basic', username, password});
done();
})
.catch(e => {
done(e);
});
gitHubWrapper.authenticate()
.then(() => {
expect(mockGithub.authenticate.calledOnce).to.be.true;
expect(mockGithub.authenticate.args[0][0]).to.eql({type: 'basic', username, password});
done();
})
.catch(e => {
done(e);
});
});

describe('2FA checks', () => {
Expand Down