2020-08-28 21:46:36 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
|
2020-08-28 23:51:46 +00:00
|
|
|
import { validateConfig } from '../../src/config';
|
2020-08-28 21:46:36 +00:00
|
|
|
|
|
|
|
describe('config', () => {
|
|
|
|
describe('validate config', () => {
|
|
|
|
it('should reject non-objects', () => {
|
|
|
|
expect(validateConfig('')).to.equal(false);
|
|
|
|
expect(validateConfig(1)).to.equal(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should insert default values', () => {
|
|
|
|
const config = {
|
|
|
|
logger: {
|
|
|
|
level: 'info',
|
|
|
|
name: 'test',
|
|
|
|
},
|
|
|
|
projects: [{
|
|
|
|
flags: undefined,
|
|
|
|
name: 'foo',
|
|
|
|
remote: {
|
|
|
|
data: {},
|
|
|
|
type: 'github-remote',
|
|
|
|
},
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
|
|
|
expect(validateConfig(config)).to.equal(true);
|
|
|
|
expect(config.projects[0].flags).to.deep.equal([]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|