Browse Source

rm mocks

pull/1/head
rozetko 2 years ago
parent
commit
89d2eacd80
  1. 4
      src/__mocks__/@grafana/runtime.ts
  2. 1
      src/jest/grafanaMock.ts
  3. 15
      src/jest/matchMedia.ts
  4. 1
      src/jest/styleMock.ts
  5. 8
      src/jest/svgTransform.ts
  6. 13
      src/jest/utils.ts

4
src/__mocks__/@grafana/runtime.ts

@ -1,4 +0,0 @@
export const getBackendSrv = () => ({
get: jest.fn(),
post: jest.fn(),
});

1
src/jest/grafanaMock.ts

@ -1 +0,0 @@
export default {};

15
src/jest/matchMedia.ts

@ -1,15 +0,0 @@
// @ts-ignore
export default global.matchMedia =
global.matchMedia ||
function (query) {
return {
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
};
};

1
src/jest/styleMock.ts

@ -1 +0,0 @@
export default {};

8
src/jest/svgTransform.ts

@ -1,8 +0,0 @@
module.exports = {
process() {
return { code: 'module.exports = {};' };
},
getCacheKey() {
return 'svgTransform';
},
};

13
src/jest/utils.ts

@ -1,13 +0,0 @@
export function mockUseStore() {
jest.mock('state/useStore', () => ({
useStore: () => ({
isUserActionAllowed: jest.fn().mockReturnValue(true),
}),
}));
}
export function mockGrafanaLocationSrv() {
jest.mock('@grafana/runtime', () => ({
getLocationSrv: jest.fn(),
}));
}
Loading…
Cancel
Save