-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into brian/multichain-token-rates
- Loading branch information
Showing
54 changed files
with
1,158 additions
and
798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
339 changes: 275 additions & 64 deletions
339
app/components/UI/Identicon/__snapshots__/index.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,33 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { render } from '@testing-library/react-native'; | ||
import Identicon from './'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import { Provider } from 'react-redux'; | ||
import useTokenList from '../../../components/hooks/DisplayName/useTokenList'; | ||
import renderWithProvider from '../../../util/test/renderWithProvider'; | ||
|
||
jest.mock('../../../components/hooks/DisplayName/useTokenList'); | ||
const ADDRESS_MOCK = '0x123'; | ||
const URI_MOCK = 'https://example.com/image.png'; | ||
|
||
describe('Identicon', () => { | ||
const mockStore = configureMockStore(); | ||
const mockUseTokenList = jest.mocked(useTokenList).mockImplementation(() => [ | ||
{ | ||
name: 'test', | ||
symbol: 'test', | ||
decimals: 123, | ||
address: '0x123', | ||
occurrences: 1, | ||
aggregators: ['test'], | ||
iconUrl: 'https://test', | ||
}, | ||
]); | ||
|
||
it('should render correctly when provided address found in tokenList and iconUrl is available', () => { | ||
const addressMock = '0x0439e60f02a8900a951603950d8d4527f400c3f1'; | ||
mockUseTokenList.mockImplementation(() => [ | ||
{ | ||
name: 'test', | ||
symbol: 'test', | ||
decimals: 123, | ||
address: addressMock, | ||
iconUrl: 'https://example.com/icon.png', | ||
occurrences: 1, | ||
aggregators: ['test'], | ||
it('renders Blockie from address', () => { | ||
const wrapper = renderWithProvider(<Identicon address={ADDRESS_MOCK} />, { | ||
state: { | ||
settings: { useBlockieIcon: true }, | ||
}, | ||
]); | ||
|
||
const initialState = { | ||
settings: { useBlockieIcon: true }, | ||
}; | ||
const store = mockStore(initialState); | ||
}); | ||
|
||
const wrapper = render( | ||
<Provider store={store}> | ||
<Identicon address={addressMock} /> | ||
</Provider>, | ||
); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
it('should render correctly when useBlockieIcon is true', () => { | ||
const initialState = { | ||
settings: { useBlockieIcon: true }, | ||
}; | ||
const store = mockStore(initialState); | ||
|
||
const wrapper = shallow( | ||
<Provider store={store}> | ||
<Identicon /> | ||
</Provider>, | ||
); | ||
it('renders Jazzicon', () => { | ||
const wrapper = renderWithProvider(<Identicon address={ADDRESS_MOCK} />, { | ||
state: { | ||
settings: { useBlockieIcon: false }, | ||
}, | ||
}); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
it('should render correctly when useBlockieIcon is false', () => { | ||
const initialState = { | ||
settings: { useBlockieIcon: false }, | ||
}; | ||
const store = mockStore(initialState); | ||
|
||
const wrapper = shallow( | ||
<Provider store={store}> | ||
<Identicon /> | ||
</Provider>, | ||
); | ||
it('renders custom URI', () => { | ||
const wrapper = renderWithProvider(<Identicon imageUri={URI_MOCK} />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.