-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue #71 -Wrong contribution type being added to .all-contributorsrc #78
Merged
kentcdodds
merged 19 commits into
all-contributors:master
from
M-ZubairAhmed:bug-wrgTypeAdded
Jun 8, 2018
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f697c73
initial issue fix
d0bad29
tests added
9a8e557
revert unneisary lint change to untouched file
dfd0212
added myself
1bdb51e
no contribution types when adding a contributor error handled
e391d89
revert commit https://github.com/jfmengels/all-contributors-cli/pull/…
595a722
reverted readme back to commit# f697c73c48eb7736942ec98fb5383c57a7f18bf4
3d9ce22
further reverted Readme to master
7cb4f5a
removed generated index from rm
e0d649b
removed generated index from rm
5428119
Merge branch 'master' into bug-wrgTypeAdded
42364ba
breaking change to cli fixed:
ac60701
Update prompt.js
845d676
Update prompt.js
ebd6c2c
Merge branch 'master' into bug-wrgTypeAdded
795b21e
added code and test in my contribution
6d26b1a
merged from master
M-ZubairAhmed 83c8f68
Merge branch 'master' into bug-wrgTypeAdded
M-ZubairAhmed e51c5a5
list of invalid contributions added in error message
M-ZubairAhmed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import prompt from '../prompt' | ||
|
||
function fixtures() { | ||
const options = { | ||
contributors: [ | ||
{ | ||
login: 'jfmengels', | ||
name: 'Jeroen Engels', | ||
avatar_url: 'https://avatars.githubusercontent.com/u/3869412?v=3', | ||
profile: 'https://github.com/jfmengels', | ||
contributions: [], | ||
}, | ||
{ | ||
login: 'kentcdodds', | ||
name: 'Kent C. Dodds', | ||
avatar_url: 'https://avatars.githubusercontent.com/u/1500684?v=3', | ||
profile: 'http://kentcdodds.com/', | ||
contributions: [], | ||
}, | ||
{ | ||
login: 'jccguimaraes', | ||
name: 'João Guimarães', | ||
avatar_url: 'https://avatars.githubusercontent.com/u/14871650?v=3', | ||
profile: 'https://github.com/jccguimaraes', | ||
contributions: [], | ||
}, | ||
], | ||
} | ||
return options | ||
} | ||
|
||
test(`should throw error if all contribution types are invalid`, () => { | ||
const options = fixtures() | ||
const username = 'userName' | ||
const contributions = 'invalidContributionType1,invalidContributionType2' | ||
expect(() => prompt(options, username, contributions)).toThrow( | ||
'Invalid contribution type(s) entered', | ||
) | ||
}) | ||
|
||
test(`should not throw error if atleast one of the contribution types is valid`, () => { | ||
const options = fixtures() | ||
const username = 'userName' | ||
const contributions = 'wrongContributionType,code' | ||
return prompt(options, username, contributions).then(answers => { | ||
expect(answers).toEqual({username: 'userName', contributions: ['code']}) | ||
}) | ||
}) | ||
|
||
test(`should filter valid contribution types from user inserted types`, () => { | ||
const options = fixtures() | ||
const username = 'userName' | ||
const contributions = | ||
'invalidContributionType1,code,invalidContributionType2,bug' | ||
return prompt(options, username, contributions).then(answers => { | ||
expect(answers.contributions.length).toBe(2) | ||
expect(answers.contributions).toEqual(['code', 'bug']) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const _ = require('lodash/fp') | ||
|
||
const util = require('../util') | ||
|
||
const linkTemplate = _.template( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make the error include a comma-separated list of the invalid contribution types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean to say, have a list of valid contribution types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want them to be able to see which contribution type they entered which was invalid so they know not to enter that again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added please take a look 👍