Event tracking for Token Detection V2 (#14441)
parent
4b2cd0ef7a
commit
6c757ab5e0
@ -0,0 +1,28 @@ |
||||
import React from 'react'; |
||||
import { Provider } from 'react-redux'; |
||||
|
||||
import testData from '../../../../../.storybook/test-data'; |
||||
import configureStore from '../../../../store/store'; |
||||
import DetectedTokensLink from './detected-tokens-link'; |
||||
|
||||
const store = configureStore(testData); |
||||
|
||||
export default { |
||||
title: 'Components/App/AssetList/DetectedTokensLink', |
||||
decorators: [(story) => <Provider store={store}>{story()}</Provider>], |
||||
id: __filename, |
||||
argTypes: { |
||||
setShowDetectedTokens: { control: 'func' }, |
||||
}, |
||||
args: { |
||||
setShowDetectedTokens: 'setShowDetectedTokensSpy', |
||||
}, |
||||
}; |
||||
|
||||
const Template = (args) => { |
||||
return <DetectedTokensLink {...args} />; |
||||
}; |
||||
|
||||
export const DefaultStory = Template.bind({}); |
||||
|
||||
DefaultStory.storyName = 'Default'; |
@ -0,0 +1,32 @@ |
||||
import * as React from 'react'; |
||||
import { |
||||
renderWithProvider, |
||||
screen, |
||||
fireEvent, |
||||
} from '../../../../../test/jest'; |
||||
import configureStore from '../../../../store/store'; |
||||
import testData from '../../../../../.storybook/test-data'; |
||||
|
||||
import DetectedTokensLink from './detected-tokens-link'; |
||||
|
||||
describe('DetectedTokensLink', () => { |
||||
let setShowDetectedTokensSpy; |
||||
const args = {}; |
||||
|
||||
beforeEach(() => { |
||||
setShowDetectedTokensSpy = jest.fn(); |
||||
args.setShowDetectedTokens = setShowDetectedTokensSpy; |
||||
}); |
||||
|
||||
it('should render number of tokens detected link', () => { |
||||
const store = configureStore(testData); |
||||
renderWithProvider(<DetectedTokensLink {...args} />, store); |
||||
|
||||
expect( |
||||
screen.getByText('3 new tokens found in this account'), |
||||
).toBeInTheDocument(); |
||||
|
||||
fireEvent.click(screen.getByText('3 new tokens found in this account')); |
||||
expect(setShowDetectedTokensSpy).toHaveBeenCalled(); |
||||
}); |
||||
}); |
Loading…
Reference in new issue