mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
d1cea85f33
* Rename `provider` to `providerConfig` The network controller `provider` state has been renamed to `providerConfig`. This better reflects what this state is, and makes this controller more closely aligned with the core network controller. All references to the provider configuration have been updated to prefer `providerConfig` over `provider`, to make the distinction clear between a provider and provider config. Closes #18902 * Add migration
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.providerConfig.chainId)]: [
|
|
{ address: '0x9' },
|
|
],
|
|
},
|
|
};
|
|
|
|
const { result } = renderHookWithProvider(
|
|
() =>
|
|
useTransactionInfo({
|
|
txParams: {
|
|
to: '0x9',
|
|
},
|
|
}),
|
|
mockState,
|
|
);
|
|
expect(result.current.isNftTransfer).toStrictEqual(true);
|
|
});
|
|
});
|
|
});
|