Skip to content

Commit

Permalink
Added a new Jest Test case
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeepngupta committed Jan 11, 2025
1 parent db8f14f commit 9494283
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const buildEslintCommand = (filenames) =>

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
'*.{ts,tsx}': 'npx tsc --noEmit',
// '*.{ts,tsx}': 'npx tsc --noEmit',
'*': 'npm run format:fix',
};
11 changes: 11 additions & 0 deletions __tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { render, screen } from '@testing-library/react';
import Home from '../pages';

describe('Index', () => {
it('renders a heading', () => {
render(<Home />);
// render(<Home/>);
const heading = screen.getByRole('heading', { level: 1 });
expect(heading).toBeInTheDocument();
});
});
4 changes: 3 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Head from 'next/head';
import Image from 'next/image';
import styles from '../styles/Home.module.css';

export default function Home() {
function Home() {
return (
<div className={styles.container}>
<Head>
Expand Down Expand Up @@ -64,3 +64,5 @@ export default function Home() {
</div>
);
}

export default Home;

1 comment on commit 9494283

@vercel
Copy link

@vercel vercel bot commented on 9494283 Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.