honigle/src/App.test.tsx

27 lines
727 B
TypeScript
Raw Normal View History

2022-01-16 15:11:27 +04:00
import React from 'react'
import { render, screen } from '@testing-library/react'
import App from './App'
2022-02-01 04:40:58 -05:00
import { GAME_TITLE } from './constants/strings'
2022-01-29 11:07:30 -07:00
beforeEach(() => {
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(),
})),
})
})
2022-01-26 21:16:02 +09:00
test('renders App component', () => {
2022-01-16 15:11:27 +04:00
render(<App />)
2022-02-01 04:40:58 -05:00
const linkElement = screen.getByText(GAME_TITLE)
2022-01-16 15:11:27 +04:00
expect(linkElement).toBeInTheDocument()
})