Fix test
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { uniq } from 'lodash';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { getBackendSrv } from '@grafana/runtime/src/services/backendSrv';
|
||||
import { EmptyState, Spinner } from '@grafana/ui';
|
||||
import { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { useAllQueryTemplatesQuery } from 'app/features/query-library';
|
||||
import { User } from 'app/features/query-library/api/types';
|
||||
import { QueryTemplate } from 'app/features/query-library/types';
|
||||
@@ -18,9 +18,9 @@ const getQueryTemplateRows = async (data: QueryTemplate[]): Promise<QueryTemplat
|
||||
const userData = Promise.all(
|
||||
userQtList.map((user) => {
|
||||
if (user.userId) {
|
||||
return backendSrv.get(`api/users/${user.userId}`);
|
||||
return getBackendSrv().get(`api/users/${user.userId}`);
|
||||
} else if (user.login) {
|
||||
return backendSrv.get(`api/users/lookup/${user.login}`);
|
||||
return getBackendSrv().get(`api/users/lookup/${user.login}`);
|
||||
} else {
|
||||
// should never happen
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -83,7 +83,7 @@ export function setupExplore(options?: SetupOptions): {
|
||||
}
|
||||
return of({ data });
|
||||
}),
|
||||
get: jest.fn(),
|
||||
get: jest.fn().mockResolvedValue({}),
|
||||
patch: jest.fn().mockRejectedValue(undefined),
|
||||
post: jest.fn(),
|
||||
put: jest.fn().mockRejectedValue(undefined),
|
||||
|
||||
@@ -16,6 +16,7 @@ export const getTestQueryList = () => ({
|
||||
uid: '65327fce-c545-489d-ada5-16f909453d12',
|
||||
resourceVersion: '1783293341664808960',
|
||||
creationTimestamp: '2024-04-25T20:32:58Z',
|
||||
annotations: { 'grafana.app/createdBy': 'user:1:admin' },
|
||||
},
|
||||
spec: {
|
||||
title: 'Elastic Query Template',
|
||||
@@ -62,6 +63,7 @@ export const getTestQueryList = () => ({
|
||||
uid: '3e71de65-efa7-40e3-8f23-124212cca455',
|
||||
resourceVersion: '1783214217151647744',
|
||||
creationTimestamp: '2024-04-25T11:05:55Z',
|
||||
annotations: { 'grafana.app/createdBy': 'user:1:admin' },
|
||||
},
|
||||
spec: {
|
||||
title: 'Loki Query Template',
|
||||
|
||||
Reference in New Issue
Block a user