# What this PR does - removes references to `topnav` - `topnav` was default enabled in grafana v9.5 - we intend to remove the toggle soon™️ ## Which issue(s) this PR closes Related to [issue link here] <!-- *Note*: If you want the issue to be auto-closed once the PR is merged, change "Related to" to "Closes" in the line above. If you have more than one GitHub issue that this PR closes, be sure to preface each issue link with a [closing keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue). This ensures that the issue(s) are auto-closed once the PR has been merged. --> ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] Added the relevant release notes label (see labels prefixed w/ `release:`). These labels dictate how your PR will show up in the autogenerated release notes.
80 lines
1.8 KiB
TypeScript
80 lines
1.8 KiB
TypeScript
/**
|
|
* globally import this, avoids needing to import it in each file
|
|
* https://stackoverflow.com/a/65871118
|
|
*/
|
|
import '@testing-library/jest-dom';
|
|
|
|
import 'plugin/dayjs';
|
|
|
|
import { TextEncoder, TextDecoder } from 'util';
|
|
|
|
jest.mock('@grafana/runtime', () => ({
|
|
__esModule: true,
|
|
config: {
|
|
featureToggles: {},
|
|
bootData: {
|
|
user: {
|
|
timezone: 'UTC',
|
|
},
|
|
},
|
|
},
|
|
getBackendSrv: jest.fn().mockImplementation(() => ({
|
|
get: jest.fn(),
|
|
post: jest.fn(),
|
|
})),
|
|
getLocationSrv: jest.fn(),
|
|
}));
|
|
|
|
Object.assign(global, { TextDecoder, TextEncoder });
|
|
|
|
// https://stackoverflow.com/a/66055672
|
|
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: jest.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // Deprecated
|
|
removeListener: jest.fn(), // Deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
})),
|
|
});
|
|
|
|
Object.defineProperty(window, 'location', {
|
|
configurable: true,
|
|
value: { reload: jest.fn() },
|
|
});
|
|
|
|
Object.defineProperty(window, 'ResizeObserver', {
|
|
writable: true,
|
|
value: class ResizeObserver {
|
|
constructor(callback: ResizeObserverCallback) {
|
|
setTimeout(() => {
|
|
callback(
|
|
[
|
|
{
|
|
contentRect: {
|
|
x: 1,
|
|
y: 2,
|
|
width: 500,
|
|
height: 500,
|
|
top: 100,
|
|
bottom: 0,
|
|
left: 100,
|
|
right: 0,
|
|
},
|
|
target: {},
|
|
} as ResizeObserverEntry,
|
|
],
|
|
this
|
|
);
|
|
});
|
|
}
|
|
observe() {}
|
|
disconnect() {}
|
|
unobserve() {}
|
|
},
|
|
});
|