1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
Matthias Kretschmann 56f5e77c49
Tests for @shared components (#1737)
* asset teaser test, story, useUserPreferences Jest mock

* fixtures & mocks

* more tests

* cleanup

* more tests

* more tests

* more tests

* more tests

* typing fix

* package updates

* reorg

* more tests

* more tests

* more tests

* more tests

* reorg, more tests

* reorg fixes

* more tests

* rebase fix

* subgraph query typing fix

* restore some storybook stories

* more tests

* more tests

* package lock fix

* graphql override
2022-11-04 15:52:40 +02:00

25 lines
744 B
TypeScript

import { fireEvent, render, screen } from '@testing-library/react'
import React from 'react'
import testRender from '../../../../.jest/testRender'
import AddToken from './index'
jest.mock('../../../@utils/web3', () => ({ addTokenToWallet: jest.fn() }))
describe('@shared/AddToken', () => {
const propsBase = {
address: '0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8',
symbol: 'OCEAN'
}
testRender(<AddToken {...propsBase} />)
it('renders with custom text', () => {
render(<AddToken {...propsBase} text="Hello Text" />)
expect(screen.getByText('Hello Text')).toBeInTheDocument()
fireEvent.click(screen.getByRole('button'))
})
it('renders minimal', () => {
render(<AddToken {...propsBase} minimal />)
})
})