36 lines
875 B
TypeScript
Executable file
36 lines
875 B
TypeScript
Executable file
/**
|
|
* Vitest test setup
|
|
*
|
|
* Configures testing environment and utilities.
|
|
*/
|
|
|
|
import { expect, afterEach, beforeAll } from 'vitest'
|
|
import { cleanup } from '@testing-library/react'
|
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
|
|
// Extend Vitest's expect with jest-dom matchers
|
|
expect.extend(matchers)
|
|
|
|
// Cleanup after each test to prevent DOM pollution
|
|
afterEach(() => {
|
|
cleanup()
|
|
})
|
|
|
|
// Mock ResizeObserver for virtualization libraries
|
|
beforeAll(() => {
|
|
global.ResizeObserver = class ResizeObserver {
|
|
observe() {}
|
|
unobserve() {}
|
|
disconnect() {}
|
|
}
|
|
|
|
// Mock element dimensions for jsdom (needed by virtualizers)
|
|
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', {
|
|
configurable: true,
|
|
value: 400,
|
|
})
|
|
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', {
|
|
configurable: true,
|
|
value: 300,
|
|
})
|
|
})
|