Skip to content

Commit

Permalink
Merge pull request #10 from 4bujak-4bujak/feat/jest
Browse files Browse the repository at this point in the history
feat: setting jest
  • Loading branch information
eun-hak authored May 24, 2024
2 parents bf21027 + 4ae0615 commit 641a60d
Show file tree
Hide file tree
Showing 8 changed files with 6,242 additions and 2,358 deletions.
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-disable no-undef */
module.exports = {
presets: ['next/babel']
};
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-disable no-undef */
module.exports = {
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom'
};
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom';
10 changes: 10 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
return [
{
source: '/',
destination: '/sign',
permanent: true // true로 설정하면 308 리다이렉션, false로 설정하면 307 리다이렉션
}
];
},

reactStrictMode: true,
webpack: (config, { isServer }) => {
if (isServer) {
Expand Down
8,553 changes: 6,196 additions & 2,357 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"test": "jest"
},
"dependencies": {
"@tanstack/react-query": "^5.36.0",
Expand All @@ -27,6 +28,9 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.12",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
Expand All @@ -37,6 +41,8 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"msw": "^2.3.0",
"postcss": "^8",
"prettier": "^3.2.5",
Expand Down
9 changes: 9 additions & 0 deletions src/components/shared/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { render } from '@testing-library/react';

import Button from './Button';

describe('Button', () => {
test('renders the Button component', () => {
render(<Button label="Hello world!" />);
});
});
9 changes: 9 additions & 0 deletions src/components/shared/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface ButtonProps {
label: string;
}

const Button = (props: ButtonProps) => {
return <button>{props.label}</button>;
};

export default Button;

0 comments on commit 641a60d

Please sign in to comment.