Skip to content

Commit

Permalink
Include ts and tsx in moduleFileExtensions for jest
Browse files Browse the repository at this point in the history
Tweak test code to avoid duplicate code
  • Loading branch information
johnnadeluy committed Jun 6, 2024
1 parent 8be5b66 commit 2502002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'src/components',
'src/style',
],
moduleFileExtensions: ['js', 'jsx'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/src/main.scss',
Expand Down
12 changes: 6 additions & 6 deletions src/components/Table/table.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ describe('Table component', () => {
<Table>
<TableHead>
<TableRow>
<TableCell type="th">Header</TableCell>
<TableCell type="th" align="right">Header</TableCell>
<TableCell type="th">Header 1</TableCell>
<TableCell type="th" align="right">Header 2</TableCell>
<TableCell type="th"></TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Example</TableCell>
<TableCell align="right">1000</TableCell>
<TableCell>Left</TableCell>
<TableCell align="right">Right</TableCell>
<TableCell align="center">Center</TableCell>
</TableRow>
<TableRow>
<TableCell>Example</TableCell>
<TableCell align="right">500</TableCell>
<TableCell>Left</TableCell>
<TableCell align="right">Right</TableCell>
<TableCell align="center">Center</TableCell>
</TableRow>
</TableBody>
Expand Down

0 comments on commit 2502002

Please sign in to comment.