-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated jest setup file and updated snapshot
- Loading branch information
1 parent
b3e59b5
commit 472606e
Showing
2 changed files
with
347 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
// Jest setup provided by Grafana scaffolding | ||
import './.config/jest-setup'; | ||
// jest.setup.js | ||
|
||
// Polyfill TextEncoder for jsdom environment | ||
if (typeof TextEncoder === 'undefined') { | ||
const { TextEncoder } = require('util'); | ||
global.TextEncoder = TextEncoder; | ||
} | ||
|
||
// Mock matchMedia for window.matchMedia used by some components | ||
Object.defineProperty(global, 'matchMedia', { | ||
writable: true, | ||
value: jest.fn().mockImplementation((query) => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: jest.fn(), | ||
removeListener: jest.fn(), | ||
addEventListener: jest.fn(), | ||
removeEventListener: jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
})), | ||
}); | ||
|
||
// Mock HTMLCanvasElement.prototype.getContext used by some components | ||
HTMLCanvasElement.prototype.getContext = () => {}; | ||
|
||
// Import jest-dom to extend Jest's expect with matchers for DOM elements | ||
import '@testing-library/jest-dom'; | ||
|
||
// Import Grafana's Jest setup | ||
import './.config/jest-setup'; | ||
|
Oops, something went wrong.