common.ts 386 B

123456789101112131415161718
  1. export const backendSrv = {
  2. get: jest.fn(),
  3. getDashboard: jest.fn(),
  4. getDashboardByUid: jest.fn(),
  5. post: jest.fn(),
  6. };
  7. export function createNavTree(...args) {
  8. let root = [];
  9. let node = root;
  10. for (let arg of args) {
  11. let child = { id: arg, url: `/url/${arg}`, text: `${arg}-Text`, children: [] };
  12. node.push(child);
  13. node = child.children;
  14. }
  15. return root;
  16. }