1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Update keystone links (#18792)

* update keystone links

* update tests

* fix lint
This commit is contained in:
Monte Lai 2023-04-25 21:33:43 +08:00 committed by GitHub
parent 07139b1aac
commit cbe438e704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 13 deletions

View File

@ -1970,6 +1970,9 @@
"message": "Want to $1 about gas?", "message": "Want to $1 about gas?",
"description": "$1 will be replaced by the learnMore translation key" "description": "$1 will be replaced by the learnMore translation key"
}, },
"learnMoreKeystone": {
"message": "Learn More"
},
"learnMoreUpperCase": { "learnMoreUpperCase": {
"message": "Learn more" "message": "Learn more"
}, },

View File

@ -33,7 +33,7 @@ export enum HardwareAffiliateLinks {
ledger = 'https://shop.ledger.com/?r=17c4991a03fa', ledger = 'https://shop.ledger.com/?r=17c4991a03fa',
gridplus = 'https://gridplus.io/?afmc=7p', gridplus = 'https://gridplus.io/?afmc=7p',
trezor = 'https://shop.trezor.io/product/trezor-one-black?offer_id=35&aff_id=11009', trezor = 'https://shop.trezor.io/product/trezor-one-black?offer_id=35&aff_id=11009',
keystone = 'https://shop.keyst.one/?rfsn=6088257.656b3e9&utm_source=refersion&utm_medium=affiliate&utm_campaign=6088257.656b3e9', keystone = 'https://keyst.one/metamask?rfsn=6088257.656b3e9&utm_source=refersion&utm_medium=affiliate&utm_campaign=6088257.656b3e9',
airgap = 'https://airgap.it/', airgap = 'https://airgap.it/',
coolwallet = 'https://www.coolwallet.io/', coolwallet = 'https://www.coolwallet.io/',
dcent = 'https://dcentwallet.com/', dcent = 'https://dcentwallet.com/',

View File

@ -18,25 +18,32 @@ jest.mock('../../../store/actions', () => ({
})); }));
jest.mock('../../../selectors', () => ({ jest.mock('../../../selectors', () => ({
getCurrentChainId: () => jest.fn().mockResolvedValue('0x1'), getCurrentChainId: () => '0x1',
getRpcPrefsForCurrentProvider: () => jest.fn().mockResolvedValue({}), getRpcPrefsForCurrentProvider: () => {
getMetaMaskAccountsConnected: () => jest.fn().mockResolvedValue([]), return {};
getMetaMaskAccounts: () => jest.fn().mockResolvedValue([]), },
getMetaMaskAccountsConnected: () => [],
getMetaMaskAccounts: () => {
return {};
},
})); }));
jest.mock('../../../ducks/history/history', () => ({ jest.mock('../../../ducks/history/history', () => ({
getMostRecentOverviewPage: () => jest.fn().mockResolvedValue('/'), getMostRecentOverviewPage: () => '',
})); }));
const mockTrackEvent = jest.fn();
const mockProps = { const mockProps = {
forgetDevice: jest.fn(), forgetDevice: () => jest.fn(),
showAlert: jest.fn(), showAlert: () => jest.fn(),
hideAlert: jest.fn(), hideAlert: () => jest.fn(),
unlockHardwareWalletAccount: jest.fn(), unlockHardwareWalletAccount: () => jest.fn(),
setHardwareWalletDefaultHdPath: jest.fn(), setHardwareWalletDefaultHdPath: () => jest.fn(),
history: {}, history: {},
defaultHdPath: "m/44'/60'/0'/0", defaultHdPath: "m/44'/60'/0'/0",
mostRecentOverviewPage: '', mostRecentOverviewPage: '',
trackEvent: () => mockTrackEvent,
}; };
const mockState = { const mockState = {
@ -148,4 +155,24 @@ describe('ConnectHardwareForm', () => {
}); });
}); });
}); });
describe('QR Hardware Wallet Steps', () => {
it('should render the QR hardware wallet steps', async () => {
const { getByText, getByLabelText } = renderWithProvider(
<ConnectHardwareForm {...mockProps} />,
mockStore,
);
const qrButton = getByLabelText('QRCode');
fireEvent.click(qrButton);
await waitFor(() => {
expect(getByText('Keystone')).toBeInTheDocument();
expect(getByText('AirGap Vault')).toBeInTheDocument();
expect(getByText('CoolWallet')).toBeInTheDocument();
expect(getByText("D'Cent")).toBeInTheDocument();
});
});
});
}); });

View File

@ -431,12 +431,12 @@ export default class SelectHardware extends Component {
onClick={() => { onClick={() => {
this.context.trackEvent({ this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation, category: MetaMetricsEventCategory.Navigation,
event: 'Clicked Keystone Buy Now', event: 'Clicked Keystone Learn More',
}); });
openWindow(HardwareAffiliateLinks.keystone); openWindow(HardwareAffiliateLinks.keystone);
}} }}
> >
{this.context.t('buyNow')} {this.context.t('learnMoreKeystone')}
</Button> </Button>
<Button <Button
className="hw-connect__external-btn" className="hw-connect__external-btn"