mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(schedule): don’t massage null value
This commit is contained in:
parent
3b387e92db
commit
77997770f1
4 changed files with 8 additions and 5 deletions
|
@ -214,10 +214,7 @@ function migrateConfig(config) {
|
||||||
isMigrated = true;
|
isMigrated = true;
|
||||||
migratedConfig.baseBranches = is.array(val) ? val : [val];
|
migratedConfig.baseBranches = is.array(val) ? val : [val];
|
||||||
delete migratedConfig.baseBranch;
|
delete migratedConfig.baseBranch;
|
||||||
} else if (key === 'schedule' && !val) {
|
} else if (key === 'schedule' && val) {
|
||||||
isMigrated = true;
|
|
||||||
migratedConfig.schedule = [];
|
|
||||||
} else if (key === 'schedule') {
|
|
||||||
// massage to array first
|
// massage to array first
|
||||||
const schedules = is.string(val) ? [val] : val;
|
const schedules = is.string(val) ? [val] : val;
|
||||||
// split 'and'
|
// split 'and'
|
||||||
|
|
|
@ -21,6 +21,9 @@ function hasValidTimezone(timezone) {
|
||||||
|
|
||||||
function hasValidSchedule(schedule) {
|
function hasValidSchedule(schedule) {
|
||||||
let message;
|
let message;
|
||||||
|
if (!schedule) {
|
||||||
|
return [true];
|
||||||
|
}
|
||||||
// check if any of the schedules fail to parse
|
// check if any of the schedules fail to parse
|
||||||
const hasFailedSchedules = schedule.some(scheduleText => {
|
const hasFailedSchedules = schedule.some(scheduleText => {
|
||||||
const massagedText = fixShortHours(scheduleText);
|
const massagedText = fixShortHours(scheduleText);
|
||||||
|
|
|
@ -98,7 +98,7 @@ Object {
|
||||||
"minor": Object {
|
"minor": Object {
|
||||||
"automerge": true,
|
"automerge": true,
|
||||||
},
|
},
|
||||||
"schedule": Array [],
|
"schedule": null,
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
"depTypeList": Array [
|
"depTypeList": Array [
|
||||||
|
|
|
@ -14,6 +14,9 @@ describe('workers/branch/schedule', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
it('returns true for null', () => {
|
||||||
|
expect(schedule.hasValidSchedule(null)[0]).toBe(true);
|
||||||
|
});
|
||||||
it('returns false for invalid schedule', () => {
|
it('returns false for invalid schedule', () => {
|
||||||
expect(schedule.hasValidSchedule(['foo'])[0]).toBe(false);
|
expect(schedule.hasValidSchedule(['foo'])[0]).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue