1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 23:06:37 +01:00
metamask-extension/ui/components/app/nft-default-image/nft-default-image.test.js
Nidhi Kumari 4c37448c97
Added IPFS toggle (#20172)
* added ipfs toggle

* added placeholder valur

* fixed snapshot

* updated tests

* updated spec file

* hide input if toggle is disabled

* updated e2e tests for nft image

* fixed view-ercc-1155 spec

* updated e2e tests for nfts

* added ipfs toggle modal

* updated UI for ipfs

* updated tests

* updated classname

* added placeholder image

* lint fix

* removed prop ipfsEnabled and used with selector

* fixed ui for ipfs toggle

* updated test

* updated  test to handle cases

* nit fix

* ensure default image height match nft image
2023-08-01 23:51:51 +05:30

56 lines
1.6 KiB
JavaScript

import React from 'react';
import configureStore from 'redux-mock-store';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import mockState from '../../../../test/data/mock-state.json';
import NftDefaultImage from '.';
describe('NFT Default Image', () => {
const mockShowIpfsModal = jest.fn();
jest.mock('../../../store/actions.ts', () => ({
showIpfsModal: () => mockShowIpfsModal,
}));
const store = configureStore()(mockState);
it('should render with no props', () => {
const { container } = renderWithProvider(<NftDefaultImage />, store);
expect(container).toMatchSnapshot();
});
it('should match snapshot with all provided props', () => {
const props = {
clickable: false,
};
const { container } = renderWithProvider(
<NftDefaultImage {...props} />,
store,
);
expect(container).toMatchSnapshot();
});
it('should match snapshot with missing clickable prop', () => {
const { container } = renderWithProvider(<NftDefaultImage />, store);
expect(container).toMatchSnapshot();
});
it('does not render component with clickable class when clickable is false', () => {
const { container } = renderWithProvider(
<NftDefaultImage clickable={false} />,
store,
);
expect(container.firstChild).not.toHaveClass('nft-default--clickable');
});
it('renders component with clickable class when clickable is true', () => {
const { container } = renderWithProvider(
<NftDefaultImage clickable />,
store,
);
expect(container.firstChild).toHaveClass('nft-default--clickable');
});
});