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:
parent
8d2dee6554
commit
ba33fc52a4
@ -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'))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user