mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
29 lines
668 B
TypeScript
29 lines
668 B
TypeScript
import "@testing-library/jest-dom"
|
|
|
|
// Mock crypto.getRandomValues
|
|
Object.defineProperty(window, "crypto", {
|
|
value: {
|
|
getRandomValues: function (buffer: Uint8Array) {
|
|
for (let i = 0; i < buffer.length; i++) {
|
|
buffer[i] = Math.floor(Math.random() * 256)
|
|
}
|
|
return buffer
|
|
},
|
|
},
|
|
})
|
|
|
|
// Mock matchMedia
|
|
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(),
|
|
})),
|
|
})
|