diff --git a/lib/config/migration.js b/lib/config/migration.js index de3df564e7e1ee2708b051bd6f2f7cb170049499..6ed9b61d2802ef41d59e69b385453b5dcfe032b0 100644 --- a/lib/config/migration.js +++ b/lib/config/migration.js @@ -214,10 +214,7 @@ function migrateConfig(config) { isMigrated = true; migratedConfig.baseBranches = is.array(val) ? val : [val]; delete migratedConfig.baseBranch; - } else if (key === 'schedule' && !val) { - isMigrated = true; - migratedConfig.schedule = []; - } else if (key === 'schedule') { + } else if (key === 'schedule' && val) { // massage to array first const schedules = is.string(val) ? [val] : val; // split 'and' diff --git a/lib/workers/branch/schedule.js b/lib/workers/branch/schedule.js index 5f541a14844ad18556ee6903ff4378c0ae7c231f..3b6e63e98f2ba12a5bf1d542227c726063213688 100644 --- a/lib/workers/branch/schedule.js +++ b/lib/workers/branch/schedule.js @@ -21,6 +21,9 @@ function hasValidTimezone(timezone) { function hasValidSchedule(schedule) { let message; + if (!schedule) { + return [true]; + } // check if any of the schedules fail to parse const hasFailedSchedules = schedule.some(scheduleText => { const massagedText = fixShortHours(scheduleText); diff --git a/test/config/__snapshots__/migration.spec.js.snap b/test/config/__snapshots__/migration.spec.js.snap index ae963250b6ff983205402ba8dc91ddaa0293960e..917a9d2b9f91da3b2d19289b36f1464150e0ec02 100644 --- a/test/config/__snapshots__/migration.spec.js.snap +++ b/test/config/__snapshots__/migration.spec.js.snap @@ -98,7 +98,7 @@ Object { "minor": Object { "automerge": true, }, - "schedule": Array [], + "schedule": null, }, Object { "depTypeList": Array [ diff --git a/test/workers/branch/schedule.spec.js b/test/workers/branch/schedule.spec.js index 1f55a95435e300a28faa6a85e3ccf28cfe1af538..f5ba42dee3f84a0292251439ed2ce557b696427a 100644 --- a/test/workers/branch/schedule.spec.js +++ b/test/workers/branch/schedule.spec.js @@ -14,6 +14,9 @@ describe('workers/branch/schedule', () => { beforeEach(() => { jest.resetAllMocks(); }); + it('returns true for null', () => { + expect(schedule.hasValidSchedule(null)[0]).toBe(true); + }); it('returns false for invalid schedule', () => { expect(schedule.hasValidSchedule(['foo'])[0]).toBe(false); });