2017-08-15 11:26:05 +00:00
|
|
|
const massage = require('../../lib/config/massage.js');
|
|
|
|
|
|
|
|
describe('config/massage', () => {
|
|
|
|
describe('massageConfig', () => {
|
|
|
|
it('returns empty', () => {
|
|
|
|
const config = {};
|
|
|
|
const res = massage.massageConfig(config);
|
|
|
|
expect(res).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
it('massages strings to array', () => {
|
|
|
|
const config = {
|
|
|
|
schedule: 'before 5am',
|
|
|
|
};
|
|
|
|
const res = massage.massageConfig(config);
|
|
|
|
expect(Array.isArray(res.schedule)).toBe(true);
|
|
|
|
});
|
2017-08-29 07:25:44 +00:00
|
|
|
it('massages npmToken', () => {
|
|
|
|
const config = {
|
|
|
|
npmToken: 'some-token',
|
|
|
|
};
|
|
|
|
expect(massage.massageConfig(config)).toMatchSnapshot();
|
|
|
|
});
|
2018-11-13 08:29:53 +00:00
|
|
|
it('massages packageRules updateTypes', () => {
|
|
|
|
const config = {
|
|
|
|
packageRules: [
|
|
|
|
{
|
|
|
|
packageNames: ['foo'],
|
|
|
|
minor: {
|
|
|
|
semanticCommitType: 'feat',
|
|
|
|
},
|
|
|
|
patch: {
|
|
|
|
semanticCommitType: 'fix',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
const res = massage.massageConfig(config);
|
|
|
|
expect(res).toMatchSnapshot();
|
|
|
|
expect(res.packageRules).toHaveLength(3);
|
|
|
|
});
|
2017-08-15 11:26:05 +00:00
|
|
|
});
|
|
|
|
});
|