1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

test coverage

This commit is contained in:
Matthias Kretschmann 2019-07-17 12:46:00 +02:00
parent b3ee23e728
commit 64008abc26
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 21 additions and 6 deletions

View File

@ -58,21 +58,29 @@ const mockResponseFaulty = {
describe('VersionNumbers', () => {
it('renders without crashing', () => {
const { container } = render(
const { container, rerender } = render(
<User.Provider value={userMockConnected}>
<VersionNumbers />
<VersionNumbers account="0x00000" />
</User.Provider>
)
mockAxios.mockResponse(mockResponse)
expect(mockAxios.get).toHaveBeenCalled()
expect(container.firstChild).toBeInTheDocument()
rerender(
<User.Provider value={userMockConnected}>
<VersionNumbers account="0x99999" />
</User.Provider>
)
mockAxios.mockResponse(mockResponse)
expect(mockAxios.get).toHaveBeenCalled()
})
it('renders without proper component response', () => {
const { container } = render(
<User.Provider value={userMockConnected}>
<StateMock state={stateMockIncomplete}>
<VersionNumbers />
<VersionNumbers account="0x00000" />
</StateMock>
</User.Provider>
)

View File

@ -7,10 +7,10 @@ import { userMockConnected } from '../../../__mocks__/user-mock'
import { marketMock } from '../../../__mocks__/market-mock'
describe('WalletSelector', () => {
it('renders without crashing', () => {
it('renders without crashing', async () => {
ReactModal.setAppElement(document.createElement('div'))
const { container } = render(
const { container, getByText } = render(
<User.Provider value={userMockConnected}>
<Market.Provider value={marketMock}>
<WalletSelector />
@ -18,6 +18,13 @@ describe('WalletSelector', () => {
</User.Provider>
)
expect(container.firstChild).toBeInTheDocument()
fireEvent.click(container.querySelector('button'))
fireEvent.click(getByText('Select wallet'))
const burnerButton = await getByText('Burner Wallet')
fireEvent.click(burnerButton)
fireEvent.click(getByText('Select wallet'))
// const metamaskButton = await getByText('MetaMask')
// fireEvent.click(metamaskButton)
})
})