2019-09-24 01:13:02 +02:00
|
|
|
import React from 'react'
|
|
|
|
import { render, fireEvent } from '@testing-library/react'
|
2020-02-25 04:10:06 +01:00
|
|
|
import {
|
|
|
|
AppContext,
|
|
|
|
PriceContext
|
|
|
|
} from '../../src/renderer/store/createContext'
|
|
|
|
import { appContext, priceContext } from '../__fixtures__/context'
|
2020-02-09 17:16:10 +01:00
|
|
|
import Home from '../../src/renderer/pages/index'
|
2019-09-24 01:13:02 +02:00
|
|
|
|
|
|
|
describe('Home', () => {
|
|
|
|
it('renders correctly', () => {
|
|
|
|
const { container, getByText } = render(
|
2020-02-25 04:10:06 +01:00
|
|
|
<PriceContext.Provider value={priceContext}>
|
|
|
|
<AppContext.Provider value={appContext}>
|
|
|
|
<Home />
|
|
|
|
</AppContext.Provider>
|
|
|
|
</PriceContext.Provider>
|
2019-09-24 01:13:02 +02:00
|
|
|
)
|
|
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
|
|
fireEvent.click(getByText(/Ξ/))
|
2020-02-09 22:16:23 +01:00
|
|
|
// fireEvent.click(getByText(/0x/))
|
2019-09-24 01:13:02 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders Welcome without config', () => {
|
|
|
|
const { container } = render(
|
2020-02-25 04:10:06 +01:00
|
|
|
<PriceContext.Provider value={priceContext}>
|
|
|
|
<AppContext.Provider value={{ ...appContext, needsConfig: true }}>
|
|
|
|
<Home />
|
|
|
|
</AppContext.Provider>
|
|
|
|
</PriceContext.Provider>
|
2019-09-24 01:13:02 +02:00
|
|
|
)
|
|
|
|
expect(container.firstChild).toHaveTextContent(
|
|
|
|
'Add your first address to get started.'
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|