mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 22:16:31 +00:00
190813c61e
* Show a helpful message when .all-contributorsrc doesn't exist. * Adding unit tests. * Better test descriptions. * Just code improvements.
18 lines
525 B
JavaScript
18 lines
525 B
JavaScript
import test from 'ava';
|
|
import configFile from './config-file.js';
|
|
|
|
const absentFile = './abc';
|
|
const expected = 'Configuration file not found: ' + absentFile;
|
|
|
|
test('Reading an absent configuration file throws a helpful error', t => {
|
|
t.throws(() => {
|
|
configFile.readConfig(absentFile);
|
|
}, expected);
|
|
});
|
|
|
|
test.cb('Writing contributors in an absent configuration file throws a helpful error', t => {
|
|
configFile.writeContributors(absentFile, [], error => {
|
|
t.is(error.message, expected);
|
|
t.end();
|
|
});
|
|
});
|