mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
da06901f79
* add fallbacks for confirmation title on nft transfers * Add token name and id * fix * fix test --------- Co-authored-by: David Walsh <davidwalsh83@gmail.com>
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import { renderHookWithProvider } from '../../test/lib/render-helpers';
|
|
import { hexToDecimal } from '../../shared/modules/conversion.utils';
|
|
import mockState from '../../test/data/mock-state.json';
|
|
import { useTransactionInfo } from './useTransactionInfo';
|
|
|
|
describe('useTransactionInfo', () => {
|
|
describe('isNftTransfer', () => {
|
|
it('should return false if transaction is not NFT transfer', () => {
|
|
const { result } = renderHookWithProvider(
|
|
() =>
|
|
useTransactionInfo({
|
|
txParams: {},
|
|
}),
|
|
mockState,
|
|
);
|
|
expect(result.current.isNftTransfer).toStrictEqual(false);
|
|
});
|
|
it('should return true if transaction is NFT transfer', () => {
|
|
mockState.metamask.allNftContracts = {
|
|
[mockState.metamask.selectedAddress]: {
|
|
[hexToDecimal(mockState.metamask.provider.chainId)]: [
|
|
{ address: '0x9' },
|
|
],
|
|
},
|
|
};
|
|
|
|
const { result } = renderHookWithProvider(
|
|
() =>
|
|
useTransactionInfo({
|
|
txParams: {
|
|
to: '0x9',
|
|
},
|
|
}),
|
|
mockState,
|
|
);
|
|
expect(result.current.isNftTransfer).toStrictEqual(true);
|
|
});
|
|
});
|
|
});
|