also looking at this
fix(gates): actually refresh the dashboard instead of reporting that it did
#1425
3 files
+86
-3
| @@ -303,6 +303,56 @@ describe('post-merge actions', () => { | ||
| 303 | 303 | draft: false, |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | it('failure case - refreshing the dashboard is not reported without a refresher', async () => { | |
| 307 | // This branch used to push `refresh-dashboard` onto `performed` and do | |
| 308 | // nothing — the one action here that claimed success with no work behind | |
| 309 | // it, which is worse than not offering the action at all. | |
| 310 | const outcome = await runPostMerge(fakeProvider(), merged, { refreshDashboard: true }) | |
| 311 | ||
| 312 | expect(outcome.performed).not.toContain('refresh-dashboard') | |
| 313 | expect(outcome.skipped).toContainEqual({ | |
| 314 | action: 'refresh-dashboard', | |
| 315 | reason: 'no dashboard refresher was supplied', | |
| 316 | }) | |
| 317 | }) | |
| 318 | ||
| 319 | it('success case - refreshes the dashboard when a refresher is supplied', async () => { | |
| 320 | let refreshed = false | |
| 321 | const outcome = await runPostMerge(fakeProvider(), merged, { refreshDashboard: true }, { | |
| 322 | refreshDashboard: async () => { | |
| 323 | refreshed = true | |
| 324 | }, | |
| 325 | }) | |
| 326 | ||
| 327 | expect(refreshed).toBe(true) | |
| 328 | expect(outcome.performed).toContain('refresh-dashboard') | |
| 329 | }) | |
| 330 | ||
| 331 | it('failure case - a refresh that throws is reported, not claimed', async () => { | |
| 332 | // The pull request has already merged, so a failed refresh must not read | |
| 333 | // as a failed run — but it must not read as a success either. | |
| 334 | const outcome = await runPostMerge(fakeProvider(), merged, { refreshDashboard: true }, { | |
| 335 | logger: Logger.silent(), | |
| 336 | refreshDashboard: async () => { | |
| 337 | throw new Error('rate limited') | |
| 338 | }, | |
| 339 | }) | |
| 340 | ||
| 341 | expect(outcome.performed).not.toContain('refresh-dashboard') | |
| 342 | expect(outcome.skipped).toContainEqual({ action: 'refresh-dashboard', reason: 'refresh failed' }) | |
| 343 | }) | |
| 344 | ||
| 345 | it('edge case - a refresher is not called when the action is off', async () => { | |
| 346 | let refreshed = false | |
| 347 | await runPostMerge(fakeProvider(), merged, {}, { | |
| 348 | refreshDashboard: async () => { | |
| 349 | refreshed = true | |
| 350 | }, | |
| 351 | }) | |
| 352 | ||
| 353 | expect(refreshed).toBe(false) | |
| 354 | }) | |
| 355 | ||
| 306 | 356 | it('success case - appends to the changelog', async () => { |
| 307 | 357 | const provider = fakeProvider() |
| 308 | 358 | const outcome = await runPostMerge(provider, merged, { changelog: { enabled: true } }) |