grafana/public/test/mocks/common.ts
2018-08-26 17:14:40 +02:00

20 lines
421 B
TypeScript

export const backendSrv = {
get: jest.fn(),
getDashboard: jest.fn(),
getDashboardByUid: jest.fn(),
getFolderByUid: jest.fn(),
post: jest.fn(),
};
export function createNavTree(...args) {
const root = [];
let node = root;
for (const arg of args) {
const child = { id: arg, url: `/url/${arg}`, text: `${arg}-Text`, children: [] };
node.push(child);
node = child.children;
}
return root;
}