26 lines
738 B
TypeScript
26 lines
738 B
TypeScript
import React from 'react'
|
|
import { render } from 'react-testing-library'
|
|
import App from './App'
|
|
import { User } from './context'
|
|
import { userMock } from '../__mocks__/user-mock'
|
|
|
|
describe('App', () => {
|
|
it('should be able to run tests', () => {
|
|
expect(1 + 2).toEqual(3)
|
|
})
|
|
|
|
it('renders without crashing', () => {
|
|
const { container } = render(<App />)
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
})
|
|
|
|
it('renders loading state', () => {
|
|
const { container } = render(
|
|
<User.Provider value={{ ...userMock, isLoading: true }}>
|
|
<App />
|
|
</User.Provider>
|
|
)
|
|
expect(container.querySelector('.spinner')).toBeInTheDocument()
|
|
})
|
|
})
|