import '@testing-library/react'

/*
 * jsdom implements neither matchMedia nor the theme APIs the application reads
 * before first paint, so they are stubbed here rather than guarded for in the
 * source. A production browser always provides them; a test environment that
 * silently returns undefined would push defensive code into the app for no
 * benefit.
 */
if (!window.matchMedia) {
  Object.defineProperty(window, 'matchMedia', {
    writable: true,
    value: (query: string): MediaQueryList =>
      ({
        matches: false,
        media: query,
        onchange: null,
        addEventListener: () => {},
        removeEventListener: () => {},
        addListener: () => {},
        removeListener: () => {},
        dispatchEvent: () => false,
      }) as unknown as MediaQueryList,
  })
}
