diff --git a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap index 735ce9523c3a6ecbe21354bc4e9927f6a5b0c0ae..81ae0077b71d82d015db95af1a42647c6bab79c9 100644 --- a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap +++ b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap @@ -31,3 +31,13 @@ This repository currently has no open or pending branches. And this is a footer " `; + +exports[`workers/repository/master-issue ensureMasterIssue() open or update Dependency Dashboard when rules contain approvals 1`] = ` +"This issue contains a list of Renovate updates and their statuses. + +This repository currently has no open or pending branches. + +--- +And this is a footer +" +`; diff --git a/lib/workers/repository/dependency-dashboard.spec.ts b/lib/workers/repository/dependency-dashboard.spec.ts index 41b4990624eeff791765e765381fa64f215e6132..6b0818edd64656c423bc46e891ada4b7e07b6cb3 100644 --- a/lib/workers/repository/dependency-dashboard.spec.ts +++ b/lib/workers/repository/dependency-dashboard.spec.ts @@ -152,6 +152,29 @@ describe('workers/repository/master-issue', () => { await dryRun(branches, platform); }); + it('open or update Dependency Dashboard when rules contain approvals', async () => { + const branches: BranchConfig[] = []; + config.packageRules = [ + { + dependencyDashboardApproval: true, + }, + {}, + ]; + config.dependencyDashboardFooter = 'And this is a footer'; + await dependencyDashboard.ensureMasterIssue(config, branches); + expect(platform.ensureIssueClosing).toHaveBeenCalledTimes(0); + expect(platform.ensureIssue).toHaveBeenCalledTimes(1); + expect(platform.ensureIssue.mock.calls[0][0].title).toBe( + config.dependencyDashboardTitle + ); + expect(platform.ensureIssue.mock.calls[0][0].body).toMatchSnapshot(); + expect(platform.getBranchPr).toHaveBeenCalledTimes(0); + expect(platform.findPr).toHaveBeenCalledTimes(0); + + // same with dry run + await dryRun(branches, platform); + }); + it('checks an issue with 2 Pending Approvals, 2 not scheduled, 2 pr-hourly-limit-reached and 2 in error', async () => { const branches: BranchConfig[] = [ {