common.ts 326 B

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