common.ts 415 B

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