fix panel migration tests

This commit is contained in:
Alexander Zobnin
2020-05-12 19:24:43 +03:00
parent f7105d9f06
commit f3545f01e5

View File

@@ -56,10 +56,17 @@ describe('Triggers Panel schema migration', () => {
const expected = _.defaultsDeep({ const expected = _.defaultsDeep({
schemaVersion: CURRENT_SCHEMA_VERSION, schemaVersion: CURRENT_SCHEMA_VERSION,
datasource: 'zabbix',
targets: [ targets: [
{ {
...DEFAULT_TARGET, ...DEFAULT_TARGET,
datasource: 'zabbix', queryType: 5,
options: {
hostsInMaintenance: true,
showTriggers: 'all triggers',
sortTriggersBy: { text: 'last change', value: 'lastchange' },
showEvents: { text: 'Problems', value: 1 },
}
} }
], ],
ageField: true, ageField: true,
@@ -79,27 +86,7 @@ describe('Triggers Panel schema migration', () => {
const expected = _.defaultsDeep({ const expected = _.defaultsDeep({
schemaVersion: CURRENT_SCHEMA_VERSION, schemaVersion: CURRENT_SCHEMA_VERSION,
targets: [{
...DEFAULT_TARGET,
datasource: 'zabbix_default'
}]
}, PANEL_DEFAULTS); }, PANEL_DEFAULTS);
expect(updatedPanelCtrl.panel).toEqual(expected); expect(updatedPanelCtrl.panel).toEqual(expected);
}); });
it('should set default targets for new panel with empty targets', () => {
ctx.scope.panel = {
targets: []
};
const updatedPanelCtrl = updatePanelCtrl(ctx.scope);
const expected = _.defaultsDeep({
targets: [{
...DEFAULT_TARGET,
datasource: 'zabbix_default'
}]
}, PANEL_DEFAULTS);
expect(updatedPanelCtrl.panel).toEqual(expected);
});
}); });