Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions __mocks__/react-icons/fa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react';

const createIconComponent = (name: string): React.FC<React.SVGProps<SVGSVGElement>> => {
const Component: React.FC<React.SVGProps<SVGSVGElement>> = (props) => {
return React.createElement('svg', {
'data-testid': `icon-${name.toLowerCase().replace('fa', '')}`,
...props,
role: 'img'
});
};

Component.displayName = name;

return Component;
};

export const FaCheck = createIconComponent('completed');
export const FaSpinner = createIconComponent('in-progress');
export const FaRegCircle = createIconComponent('new');
export const FaTrash = createIconComponent('trash');
17 changes: 17 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'^#model(.*)$': '<rootDir>/src/model$1',
'^#state(.*)$': '<rootDir>/src/state$1',
'^#ui(.*)$': '<rootDir>/src/ui$1',
'^#hooks(.*)$': '<rootDir>/src/hooks$1',
'^#structure(.*)$': '<rootDir>/src/structure$1',
},
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
};
30 changes: 23 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,36 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-modal": "^3.16.3"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.5.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.6.0",
"vite": "^4.0.0",
"@types/react-modal": "^3.16.3",
"@vitejs/plugin-react": "^3.0.0",
"tailwindcss": "^3.0.0",
"autoprefixer": "^10.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"postcss": "^8.0.0",
"autoprefixer": "^10.0.0"
}
"tailwindcss": "^3.0.0",
"ts-jest": "^29.1.0",
"typescript": "^4.6.0",
"vite": "^4.0.0"
},
"packageManager": "pnpm@10.6.2+sha512.47870716bea1572b53df34ad8647b42962bc790ce2bf4562ba0f643237d7302a3d6a8ecef9e4bdfc01d23af1969aa90485d4cebb0b9638fa5ef1daef656f6c1b"
}
Loading