2019-01-23 11:15:27 +01:00
|
|
|
import React from 'react'
|
2019-05-31 13:38:38 +02:00
|
|
|
import { render } from '@testing-library/react'
|
2019-01-23 11:15:27 +01:00
|
|
|
import App from './App'
|
2019-04-30 19:19:28 +02:00
|
|
|
import { User } from './context'
|
2020-01-31 18:03:13 +01:00
|
|
|
import { userMock, userMockConnected } from './__mocks__/user-mock'
|
2019-01-18 17:34:40 +01:00
|
|
|
|
2019-04-15 23:30:35 +02:00
|
|
|
describe('App', () => {
|
2019-04-30 19:19:28 +02:00
|
|
|
it('should be able to run tests', () => {
|
|
|
|
expect(1 + 2).toEqual(3)
|
|
|
|
})
|
|
|
|
|
2019-04-15 23:30:35 +02:00
|
|
|
it('renders without crashing', () => {
|
2019-05-31 12:56:13 +02:00
|
|
|
const { container } = render(
|
|
|
|
<User.Provider value={userMockConnected}>
|
|
|
|
<App />
|
|
|
|
</User.Provider>
|
|
|
|
)
|
2019-04-15 23:30:35 +02:00
|
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
|
|
})
|
2019-04-30 19:19:28 +02:00
|
|
|
|
|
|
|
it('renders loading state', () => {
|
|
|
|
const { container } = render(
|
|
|
|
<User.Provider value={{ ...userMock, isLoading: true }}>
|
|
|
|
<App />
|
|
|
|
</User.Provider>
|
|
|
|
)
|
|
|
|
expect(container.querySelector('.spinner')).toBeInTheDocument()
|
|
|
|
})
|
2019-01-23 11:15:27 +01:00
|
|
|
})
|