diff --git a/webapp/config-overrides.js b/webapp/config-overrides.js index ddb0624b25..8b6e0f7f2d 100644 --- a/webapp/config-overrides.js +++ b/webapp/config-overrides.js @@ -1,32 +1,39 @@ const { override, babelInclude } = require('customize-cra') const path = require('path') +const overridedConfig = override( + babelInclude([ + path.resolve(__dirname, 'src'), + path.resolve(__dirname, 'node_modules/react-virtualized-auto-sizer'), + path.resolve( + __dirname, + 'node_modules/decentraland-connect/node_modules/@walletconnect' + ), + path.resolve('node_modules/@metamask/utils/node_modules/superstruct'), + path.resolve(__dirname, 'node_modules/@walletconnect'), + path.resolve(__dirname, 'node_modules/@dcl/single-sign-on-client'), + path.resolve(__dirname, 'node_modules/@0xsquid/sdk'), + path.resolve(__dirname, 'node_modules/@cosmjs'), + path.resolve(__dirname, 'node_modules/cosmjs-types'), + path.resolve(__dirname, 'node_modules/ethers-multicall-provide'), + path.resolve(__dirname, 'node_modules/@noble') + ]) +) + +const jestConfig = config => { + config.transformIgnorePatterns = [ + 'node_modules/?!@0xsquid|eccrypto|libsodium-wrappers-sumo' + ] + config.moduleNameMapper = { + '@dcl/single-sign-on-client': 'identity-obj-proxy', + '^react-native$': 'react-native-web', + '^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy' + } + console.log('config: ', config) + return config +} + module.exports = { - jest: config => { - config.transformIgnorePatterns = [ - 'node_modules/?!@0xsquid|eccrypto|libsodium-wrappers-sumo' - ] - config.moduleNameMapper = { - '@dcl/single-sign-on-client': 'identity-obj-proxy' - } - return config - }, - ...override( - babelInclude([ - path.resolve(__dirname, 'src'), - path.resolve(__dirname, 'node_modules/react-virtualized-auto-sizer'), - path.resolve( - __dirname, - 'node_modules/decentraland-connect/node_modules/@walletconnect' - ), - path.resolve('node_modules/@metamask/utils/node_modules/superstruct'), - path.resolve(__dirname, 'node_modules/@walletconnect'), - path.resolve(__dirname, 'node_modules/@dcl/single-sign-on-client'), - path.resolve(__dirname, 'node_modules/@0xsquid/sdk'), - path.resolve(__dirname, 'node_modules/@cosmjs'), - path.resolve(__dirname, 'node_modules/cosmjs-types'), - path.resolve(__dirname, 'node_modules/ethers-multicall-provide'), - path.resolve(__dirname, 'node_modules/@noble') - ]) - ) + ...overridedConfig, + jest: jestConfig } diff --git a/webapp/package.json b/webapp/package.json index 9528154b4e..2d42fc8f45 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -120,10 +120,5 @@ "last 1 safari version" ] }, - "homepage": "", - "jest": { - "moduleNameMapper": { - "@dcl/single-sign-on-client": "identity-obj-proxy" - } - } + "homepage": "" } diff --git a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx index e01b95af28..c938142137 100644 --- a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx +++ b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx @@ -31,7 +31,7 @@ import { ItemSaleActions } from '../SaleActionBox/ItemSaleActions' import { BuyOptions, Props } from './BestBuyingOption.types' import styles from './BestBuyingOption.module.css' -const BestBuyingOption = ({ asset, tableRef, onBuyWithCrypto }: Props) => { +const BestBuyingOption = ({ asset, tableRef }: Props) => { const [buyOption, setBuyOption] = useState(null) const [isLoading, setIsLoading] = useState(false) const [listing, setListing] = useState<{ diff --git a/webapp/src/components/AssetPage/SaleActionBox/ItemSaleActions/ItemSaleActions.tsx b/webapp/src/components/AssetPage/SaleActionBox/ItemSaleActions/ItemSaleActions.tsx index d308b3ddb0..fb4595de44 100644 --- a/webapp/src/components/AssetPage/SaleActionBox/ItemSaleActions/ItemSaleActions.tsx +++ b/webapp/src/components/AssetPage/SaleActionBox/ItemSaleActions/ItemSaleActions.tsx @@ -4,16 +4,10 @@ import { t } from 'decentraland-dapps/dist/modules/translation/utils' import { getBuilderCollectionDetailUrl } from '../../../../modules/collection/utils' import { AssetType } from '../../../../modules/asset/types' import { BuyNFTButtons } from '../BuyNFTButtons' - -import styles from './ItemSaleActions.module.css' import { Props } from './ItemSaleActions.types' +import styles from './ItemSaleActions.module.css' -const ItemSaleActions = ({ - item, - wallet, - customClassnames, - onBuyWithCrypto -}: Props) => { +const ItemSaleActions = ({ item, wallet, customClassnames }: Props) => { const isOwner = wallet?.address === item.creator const canBuy = !isOwner && item.isOnSale && item.available > 0 const builderCollectionUrl = getBuilderCollectionDetailUrl( diff --git a/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.spec.tsx b/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.spec.tsx deleted file mode 100644 index 2b169d3353..0000000000 --- a/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.spec.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { fireEvent } from '@testing-library/react' -import { renderWithProviders } from '../../../utils/test' -import ConfirmDeleteListModal, { - CANCEL_DATA_TEST_ID, - CONFIRM_DATA_TEST_ID -} from './BuyWithCryptoModal' -import { Props } from './BuyWithCryptoModal.types' - -function renderConfirmListModal(props: Partial = {}) { - return renderWithProviders( - - ) -} - -let renderedModal: ReturnType - -describe('when the delete list procedure is loading', () => { - beforeEach(() => { - renderedModal = renderConfirmListModal({ isLoading: true }) - }) - - it('should render the confirm button as disabled and loading', () => { - const { getByTestId } = renderedModal - const acceptButton = getByTestId(CONFIRM_DATA_TEST_ID) - - expect(acceptButton).toHaveAttribute('disabled') - expect(acceptButton).toHaveClass('loading') - }) - - it('should render the cancel button as disabled', () => { - const { getByTestId } = renderedModal - expect(getByTestId(CANCEL_DATA_TEST_ID)).toHaveAttribute('disabled') - }) -}) - -describe('when the confirm button is clicked', () => { - let onConfirm: jest.Mock - beforeEach(() => { - onConfirm = jest.fn() - renderedModal = renderConfirmListModal({ onConfirm }) - fireEvent.click(renderedModal.getByTestId(CONFIRM_DATA_TEST_ID)) - }) - - it('should call the onConfirm callback', () => { - expect(onConfirm).toHaveBeenCalled() - }) -}) - -describe('when the cancel button is clicked', () => { - let onClose: jest.Mock - beforeEach(() => { - onClose = jest.fn() - renderedModal = renderConfirmListModal({ onClose }) - fireEvent.click(renderedModal.getByTestId(CANCEL_DATA_TEST_ID)) - }) - - it('should call the onConfirm callback', () => { - expect(onClose).toHaveBeenCalled() - }) -})