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

fix test coverage

This commit is contained in:
Matthias Kretschmann 2019-07-15 16:14:55 +02:00
parent 8d2dee6554
commit ba33fc52a4
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { render } from '@testing-library/react' import { render, fireEvent } from '@testing-library/react'
import { toDataUrl } from 'ethereum-blockies' import { toDataUrl } from 'ethereum-blockies'
import Account from './Account' import Account from './Account'
import { User } from '../../context' import { User } from '../../context'
@ -18,12 +18,13 @@ describe('Account', () => {
}) })
it('outputs empty state without account', () => { it('outputs empty state without account', () => {
const { container } = render( const { container, getByText } = render(
<User.Provider value={{ ...userMockConnected, account: '' }}> <User.Provider value={{ ...userMockConnected, account: '' }}>
<Account /> <Account />
</User.Provider> </User.Provider>
) )
expect(container.firstChild).toHaveTextContent('No account selected') expect(container.firstChild).toHaveTextContent('No account selected')
fireEvent.click(getByText('Unlock Account'))
}) })
it('outputs blockie img', () => { it('outputs blockie img', () => {
@ -41,4 +42,20 @@ describe('Account', () => {
blockies blockies
) )
}) })
it('Account info can be toggled', () => {
const { container, getByText } = render(
<User.Provider
value={{
...userMockConnected,
isBurner: true,
account: '0xxxxxxxxxxxxxxx'
}}
>
<Account />
</User.Provider>
)
expect(container.firstChild).toBeInTheDocument()
fireEvent.click(getByText('Burner Wallet'))
})
}) })