2016-03-06 09:40:19 +00:00
|
|
|
import test from 'ava';
|
|
|
|
import _ from 'lodash/fp';
|
2016-05-05 14:27:26 +00:00
|
|
|
import formatBadge from './format-badge';
|
2016-03-06 09:40:19 +00:00
|
|
|
|
|
|
|
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');
|
|
|
|
});
|