Skip to content

Commit

Permalink
added adjustments for jest.
Browse files Browse the repository at this point in the history
  • Loading branch information
isazaharadeen committed Jan 28, 2025
1 parent 6be0067 commit 2b37573
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 4 additions & 6 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
module.exports = {
setupFiles: ['./jest.setup.js'],
transform: {
'^.+\\.[tj]sx?$': 'babel-jest', // Using Babel for transforming JS, JSX, TS, and TSX
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleNameMapper: {
'\\.svg\\?react$': '<rootDir>/test/__mocks__/svgMock.js', // Add this line
'\\.svg$': '<rootDir>/test/__mocks__/svgMock.js',
'\\.css$': '<rootDir>/test/__mocks__/styleMock.js',
'^src/(.*)$': ['<rootDir>/src/$1'],
},
transformIgnorePatterns: [
'node_modules/(?!(axios|starknetkit)/)', // Ignore transforming node_modules
],

testEnvironment: 'jsdom', // Use node as the test environment
transformIgnorePatterns: ['node_modules/(?!(axios|starknetkit)/)'],
testEnvironment: 'jsdom',
};
6 changes: 3 additions & 3 deletions frontend/src/services/wallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';
import { connect, disconnect } from 'starknetkit';
import { InjectedConnector } from 'starknetkit/injected';
import { ETH_ADDRESS, STRK_ADDRESS, USDC_ADDRESS } from '../utils/constants';
import ETH from '../assets/icons/ethereum.svg';
import USDC from '../assets/icons/borrow_usdc.svg';
import STRK from '../assets/icons/strk.svg';
import ETH from '../assets/icons/ethereum.svg?react';
import USDC from '../assets/icons/borrow_usdc.svg?react';
import STRK from '../assets/icons/strk.svg?react';

const CRM_TOKEN_ADDRESS = '0x051c4b1fe3bf6774b87ad0b15ef5d1472759076e42944fff9b9f641ff13e5bbe';

Expand Down
11 changes: 8 additions & 3 deletions frontend/test/__mocks__/svgMock.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import React from 'react';

const SvgMock = React.forwardRef((props, ref) => <span ref={ref} {...props} />);
const SvgMock = React.forwardRef((props, ref) => (
<span ref={ref} {...props} data-testid="svg-mock">
SVG Mock
</span>
));

export const ReactComponent = SvgMock;
export default SvgMock;
SvgMock.displayName = 'SvgMock';

module.exports = SvgMock;

0 comments on commit 2b37573

Please sign in to comment.