forked from MetaMask/metamask-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Event tracking for Token Detection V2 (MetaMask#14441)
- Loading branch information
1 parent
4b2cd0e
commit 6c757ab
Showing
17 changed files
with
231 additions
and
38 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
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
28 changes: 28 additions & 0 deletions
28
ui/components/app/asset-list/detetcted-tokens-link/detected-tokens-link.stories.js
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 |
---|---|---|
@@ -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'; |
32 changes: 32 additions & 0 deletions
32
ui/components/app/asset-list/detetcted-tokens-link/detected-tokens-link.test.js
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 |
---|---|---|
@@ -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(); | ||
}); | ||
}); |
Oops, something went wrong.