triggers: fix adding new panel

This commit is contained in:
Alexander Zobnin
2018-11-16 14:09:40 +03:00
parent faf66a60e6
commit f5cb445b7a
2 changed files with 22 additions and 1 deletions

View File

@@ -74,4 +74,20 @@ describe('Triggers Panel schema migration', () => {
}, PANEL_DEFAULTS);
expect(updatedPanelCtrl.panel).toEqual(expected);
});
it('should set default targets for new panel with empty targets', () => {
ctx.scope.panel = {
targets: [{}]
};
let updatedPanelCtrl = new TriggerPanelCtrl(ctx.scope, {}, timeoutMock, datasourceSrvMock, {}, {}, {});
let expected = _.defaultsDeep({
datasources: ['zabbix_default'],
targets: {
'zabbix_default': DEFAULT_TARGET
},
}, PANEL_DEFAULTS);
expect(updatedPanelCtrl.panel).toEqual(expected);
});
});