mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 14:06:34 +00:00
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
|
import test from 'ava';
|
||
|
import _ from 'lodash/fp';
|
||
|
import formatBadge from './formatBadge';
|
||
|
|
||
|
const fixtures = () => {
|
||
|
const options = {
|
||
|
projectOwner: 'jfmengels',
|
||
|
projectName: 'all-contributors-cli',
|
||
|
imageSize: 100
|
||
|
};
|
||
|
return {options};
|
||
|
}
|
||
|
|
||
|
test('should return badge with the number of contributors', t => {
|
||
|
const options = {};
|
||
|
const expected8 =
|
||
|
'[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)';
|
||
|
const expected16 =
|
||
|
'[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)';
|
||
|
|
||
|
t.is(formatBadge(options, _.times(_.constant({}), 8)), expected8);
|
||
|
t.is(formatBadge(options, _.times(_.constant({}), 16)), expected16);
|
||
|
});
|
||
|
|
||
|
test('should be able to specify custom badge template', t => {
|
||
|
const options = {
|
||
|
badgeTemplate: 'We have <%= contributors.length %> contributors'
|
||
|
};
|
||
|
|
||
|
t.is(formatBadge(options, _.times(_.constant({}), 8)), 'We have 8 contributors');
|
||
|
t.is(formatBadge(options, _.times(_.constant({}), 16)), 'We have 16 contributors');
|
||
|
});
|