1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00
metamask-extension/ui/hooks/useTransactionInfo.test.js

37 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

import { renderHookWithProvider } from '../../test/lib/render-helpers';
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]: {
[mockState.metamask.providerConfig.chainId]: [{ address: '0x9' }],
},
};
const { result } = renderHookWithProvider(
() =>
useTransactionInfo({
txParams: {
to: '0x9',
},
}),
mockState,
);
expect(result.current.isNftTransfer).toStrictEqual(true);
});
});
});