Fixed tests / added i18n
This commit is contained in:
@@ -2,16 +2,11 @@ import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import { PluginExtensionPoints, PluginExtensionTypes } from '@grafana/data';
|
||||
import { usePluginLinks } from '@grafana/runtime';
|
||||
import { setPluginLinksHook } from '@grafana/runtime';
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
|
||||
import { DrilldownExtensionPoint } from './DrilldownExtensionPoint';
|
||||
|
||||
jest.mock('@grafana/runtime', () => ({
|
||||
...jest.requireActual('@grafana/runtime'),
|
||||
usePluginLinks: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('@grafana/data', () => ({
|
||||
...jest.requireActual('@grafana/data'),
|
||||
getDefaultTimeRange: jest.fn(() => ({
|
||||
@@ -23,18 +18,25 @@ jest.mock('@grafana/data', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const usePluginLinksMock = jest.mocked(usePluginLinks);
|
||||
|
||||
const mockGlobalOpen = jest.fn();
|
||||
global.open = mockGlobalOpen;
|
||||
|
||||
let usePluginLinksMock: jest.Mock;
|
||||
|
||||
beforeAll(() => {
|
||||
usePluginLinksMock = jest.fn().mockReturnValue({ links: [], isLoading: false });
|
||||
setPluginLinksHook(usePluginLinksMock);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
usePluginLinksMock.mockClear();
|
||||
usePluginLinksMock.mockReturnValue({ links: [], isLoading: false });
|
||||
mockGlobalOpen.mockClear();
|
||||
});
|
||||
|
||||
describe('DrilldownExtensionPoint', () => {
|
||||
const defaultQueries: DataQuery[] = [{ refId: 'A' }];
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should render the button when queryless app links are available', () => {
|
||||
usePluginLinksMock.mockReturnValue({
|
||||
links: [
|
||||
|
||||
@@ -7504,7 +7504,8 @@
|
||||
"loading-placeholder": "Loading..."
|
||||
},
|
||||
"queryless-apps-extensions": {
|
||||
"aria-label-go-queryless": "Go queryless"
|
||||
"aria-label-go-queryless": "Go queryless",
|
||||
"open-in-drilldown": "Open in Drilldown"
|
||||
},
|
||||
"raw-list-container": {
|
||||
"item-count": "Result series: {{numItems}}",
|
||||
|
||||
Reference in New Issue
Block a user