Prevent MR Widget error when no CI configured

This commit is contained in:
Simon Knox 2018-02-12 18:20:52 +11:00
parent 498ade4801
commit 4e732deca8
3 changed files with 15 additions and 0 deletions

View file

@ -152,6 +152,7 @@ export default {
},
handleNotification(data) {
if (data.ci_status === this.mr.ciStatus) return;
if (!data.pipeline) return;
const label = data.pipeline.details.status.label;
const title = `Pipeline ${label}`;

View file

@ -0,0 +1,5 @@
---
title: Prevent MR Widget error when no CI configured
merge_request:
author:
type: fixed

View file

@ -295,6 +295,15 @@ describe('mrWidgetOptions', () => {
expect(notify.notifyMe).not.toHaveBeenCalled();
});
it('should not notify if no pipeline provided', () => {
vm.handleNotification({
...data,
pipeline: undefined,
});
expect(notify.notifyMe).not.toHaveBeenCalled();
});
});
describe('resumePolling', () => {