Fix PR feedback

This commit is contained in:
Tobias Skarhed
2018-06-14 14:37:48 +02:00
parent a3552a60e1
commit 23abf044ff
@@ -14,43 +14,39 @@ describe('given dashboard with repeated panels', () => {
beforeEach(done => { beforeEach(done => {
dash = { dash = {
templating: { list: [] }, templating: {
annotations: { list: [] }, list: [
}; {
config.buildInfo = {
version: '3.0.2',
};
dash.templating.list.push({
name: 'apps', name: 'apps',
type: 'query', type: 'query',
datasource: 'gfdb', datasource: 'gfdb',
current: { value: 'Asd', text: 'Asd' }, current: { value: 'Asd', text: 'Asd' },
options: [{ value: 'Asd', text: 'Asd' }], options: [{ value: 'Asd', text: 'Asd' }],
}); },
{
dash.templating.list.push({
name: 'prefix', name: 'prefix',
type: 'constant', type: 'constant',
current: { value: 'collectd', text: 'collectd' }, current: { value: 'collectd', text: 'collectd' },
options: [], options: [],
}); },
{
dash.templating.list.push({
name: 'ds', name: 'ds',
type: 'datasource', type: 'datasource',
query: 'testdb', query: 'testdb',
current: { value: 'prod', text: 'prod' }, current: { value: 'prod', text: 'prod' },
options: [], options: [],
}); },
],
dash.annotations.list.push({ },
annotations: {
list: [
{
name: 'logs', name: 'logs',
datasource: 'gfdb', datasource: 'gfdb',
}); },
],
dash.panels = [ },
panels: [
{ id: 6, datasource: 'gfdb', type: 'graph' }, { id: 6, datasource: 'gfdb', type: 'graph' },
{ id: 7 }, { id: 7 },
{ {
@@ -59,15 +55,19 @@ describe('given dashboard with repeated panels', () => {
targets: [{ datasource: 'other' }], targets: [{ datasource: 'other' }],
}, },
{ id: 9, datasource: '$ds' }, { id: 9, datasource: '$ds' },
]; {
dash.panels.push({
id: 2, id: 2,
repeat: 'apps', repeat: 'apps',
datasource: 'gfdb', datasource: 'gfdb',
type: 'graph', type: 'graph',
}); },
dash.panels.push({ id: 3, repeat: null, repeatPanelId: 2 }); { id: 3, repeat: null, repeatPanelId: 2 },
],
};
config.buildInfo = {
version: '3.0.2',
};
//Stubs test function calls //Stubs test function calls
var datasourceSrvStub = { get: jest.fn(arg => getStub(arg)) }; var datasourceSrvStub = { get: jest.fn(arg => getStub(arg)) };
@@ -157,7 +157,6 @@ describe('given dashboard with repeated panels', () => {
}); });
}); });
function getStub(arg) {
// Stub responses // Stub responses
var stubs = []; var stubs = [];
stubs['gfdb'] = { stubs['gfdb'] = {
@@ -190,5 +189,6 @@ function getStub(arg) {
}, },
}; };
function getStub(arg) {
return Promise.resolve(stubs[arg]); return Promise.resolve(stubs[arg]);
} }