-
Notifications
You must be signed in to change notification settings - Fork 144
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
Changes from 5 commits
f697c73
d0bad29
9a8e557
dfd0212
1bdb51e
e391d89
595a722
3d9ce22
7cb4f5a
e0d649b
5428119
42364ba
ac60701
845d676
ebd6c2c
795b21e
6d26b1a
83c8f68
e51c5a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
[![version][version-badge]][package] [![downloads][downloads-badge]][downloads] | ||
[![MIT License][license-badge]][license] | ||
|
||
[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] | ||
[![Watch on GitHub][github-watch-badge]][github-watch] | ||
[![Star on GitHub][github-star-badge]][github-star] | ||
|
@@ -35,9 +35,10 @@ specification. | |
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Generating the contributors list](#generating-the-contributors-list) | ||
- [Add/update contributors](#addupdate-contributors) | ||
- [Check for missing contributors](#check-for-missing-contributors) | ||
- [Configuration](#configuration) | ||
- [Inspiration](#inspiration) | ||
- [Other Solutions](#other-solutions) | ||
- [Contributors](#contributors) | ||
- [LICENSE](#license) | ||
|
||
|
@@ -167,13 +168,11 @@ Thanks goes to these wonderful people | |
([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): | ||
|
||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you remove that space by hand, or did the command output change? 🤔 |
||
<!-- prettier-ignore --> | ||
| [<img src="https://avatars.githubusercontent.com/u/3869412?v=3" width="100px;"/><br /><sub><b>Jeroen Engels</b></sub>](https://github.com/jfmengels)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Code") [📖](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Documentation") [⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=jfmengels "Tests") | [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](http://kentcdodds.com/)<br />[📖](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds "Documentation") [💻](https://github.com/jfmengels/all-contributors-cli/commits?author=kentcdodds "Code") | [<img src="https://avatars.githubusercontent.com/u/14871650?v=3" width="100px;"/><br /><sub><b>João Guimarães</b></sub>](https://github.com/jccguimaraes)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=jccguimaraes "Code") | [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub><b>Ben Briggs</b></sub>](http://beneb.info)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=ben-eb "Code") | [<img src="https://avatars.githubusercontent.com/u/22768990?v=3" width="100px;"/><br /><sub><b>Itai Steinherz</b></sub>](https://github.com/itaisteinherz)<br />[📖](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz "Documentation") [💻](https://github.com/jfmengels/all-contributors-cli/commits?author=itaisteinherz "Code") | [<img src="https://avatars.githubusercontent.com/u/5701162?v=3" width="100px;"/><br /><sub><b>Alex Jover</b></sub>](https://github.com/alexjoverm)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm "Code") [📖](https://github.com/jfmengels/all-contributors-cli/commits?author=alexjoverm "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/8212?v=3" width="100px;"/><br /><sub><b>Jerod Santo</b></sub>](https://jerodsanto.net)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=jerodsanto "Code") | | ||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | | ||
| [<img src="https://avatars1.githubusercontent.com/u/574871?v=3" width="100px;"/><br /><sub><b>Kevin Jalbert</b></sub>](https://github.com/kevinjalbert)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=kevinjalbert "Code") | [<img src="https://avatars3.githubusercontent.com/u/5038030?v=4" width="100px;"/><br /><sub><b>tunnckoCore</b></sub>](https://i.am.charlike.online)<br />[🔧](#tool-charlike "Tools") | [<img src="https://avatars2.githubusercontent.com/u/304450?v=4" width="100px;"/><br /><sub><b>Mehdi Achour</b></sub>](https://machour.idk.tn/)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=machour "Code") | [<img src="https://avatars1.githubusercontent.com/u/8344688?v=4" width="100px;"/><br /><sub><b>Roy Revelt</b></sub>](https://codsen.com)<br />[🐛](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3Arevelt "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/422331?v=4" width="100px;"/><br /><sub><b>Chris Vickery</b></sub>](https://github.com/chrisinajar)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=chrisinajar "Code") | [<img src="https://avatars2.githubusercontent.com/u/1026002?v=4" width="100px;"/><br /><sub><b>Bryce Reynolds</b></sub>](https://github.com/brycereynolds)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=brycereynolds "Code") | [<img src="https://avatars3.githubusercontent.com/u/2322305?v=4" width="100px;"/><br /><sub><b>James, please</b></sub>](http://www.jmeas.com)<br />[🤔](#ideas-jmeas "Ideas, Planning, & Feedback") [💻](https://github.com/jfmengels/all-contributors-cli/commits?author=jmeas "Code") | | ||
| [<img src="https://avatars3.githubusercontent.com/u/1057324?v=4" width="100px;"/><br /><sub><b>Spyros Ioakeimidis</b></sub>](http://www.spyros.io)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=spirosikmd "Code") | [<img src="https://avatars3.githubusercontent.com/u/12335761?v=4" width="100px;"/><br /><sub><b>Fernando Costa</b></sub>](https://github.com/fadc80)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=fadc80 "Code") | [<img src="https://avatars0.githubusercontent.com/u/197404?v=4" width="100px;"/><br /><sub><b>snipe</b></sub>](https://snipe.net)<br />[📖](https://github.com/jfmengels/all-contributors-cli/commits?author=snipe "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/997157?v=4" width="100px;"/><br /><sub><b>Gant Laborde</b></sub>](http://gantlaborde.com/)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=GantMan "Code") | | ||
|
||
| [<img src="https://avatars3.githubusercontent.com/u/1057324?v=4" width="100px;"/><br /><sub><b>Spyros Ioakeimidis</b></sub>](http://www.spyros.io)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=spirosikmd "Code") | [<img src="https://avatars3.githubusercontent.com/u/12335761?v=4" width="100px;"/><br /><sub><b>Fernando Costa</b></sub>](https://github.com/fadc80)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=fadc80 "Code") | [<img src="https://avatars0.githubusercontent.com/u/197404?v=4" width="100px;"/><br /><sub><b>snipe</b></sub>](https://snipe.net)<br />[📖](https://github.com/jfmengels/all-contributors-cli/commits?author=snipe "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/997157?v=4" width="100px;"/><br /><sub><b>Gant Laborde</b></sub>](http://gantlaborde.com/)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=GantMan "Code") | [<img src="https://avatars2.githubusercontent.com/u/17708702?v=4" width="100px;"/><br /><sub><b>Md Zubair Ahmed</b></sub>](https://in.linkedin.com/in/mzubairahmed)<br />[💻](https://github.com/jfmengels/all-contributors-cli/commits?author=M-ZubairAhmed "Code") [⚠️](https://github.com/jfmengels/all-contributors-cli/commits?author=M-ZubairAhmed "Tests") [🐛](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3AM-ZubairAhmed "Bug reports") | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
|
||
This project follows the | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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: [Array], | ||
}, | ||
{ | ||
login: 'kentcdodds', | ||
name: 'Kent C. Dodds', | ||
avatar_url: 'https://avatars.githubusercontent.com/u/1500684?v=3', | ||
profile: 'http://kentcdodds.com/', | ||
contributions: [Array], | ||
}, | ||
{ | ||
login: 'jccguimaraes', | ||
name: 'João Guimarães', | ||
avatar_url: 'https://avatars.githubusercontent.com/u/14871650?v=3', | ||
profile: 'https://github.com/jccguimaraes', | ||
contributions: [Array], | ||
}, | ||
], | ||
} | ||
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']) | ||
}) | ||
}) | ||
|
||
test(`should throw error if no contribution types were included in add command`, () => { | ||
const options = fixtures() | ||
const username = 'userName' | ||
const contributions = '' | ||
expect(() => prompt(options, username, contributions)).toThrow( | ||
`No contribution type found in the input. Did you forget to include them in the add command?`, | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok let us handle this in another pr then |
||
}) |
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( | ||
|
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.
This should be dealt with in another PR.