Files
portfolio/app/__tests__/components/Projects.test.tsx
denshooter a7d636bff4 Dev (#47)
* 🚀 refactor: simplify deployment process in workflow file

* 🚀 chore: add IMAGE_NAME to GITHUB_ENV for deployment workflow

*  chore: simplify deployment logging in workflow file

* 🚀 fix: correct container name in deployment script logic

* 🚀 refactor: rename job and streamline deployment steps

* Update README.md

*  fix: prevent multiple form submissions in Contact component

*  feat: honeypot and timestamp checks to form submission

*  refactor: simplify contact form and improve UI elements

*  feat: add responsive masonry layout for projects display

*  style: Update project title size and improve layout visibility

*  fix: remove unnecessary test assertions and improve act usage

*  chore: add @types/react-responsive-masonry package

fixing with this import error on building

*  chore: remove unused dev dependencies from package-lock.json

*  refactor: update environment variable usage and add caching

*  refactor: update environment variables and dependencies

*  chore: streamline Dockerfile and remove redundant steps
2025-02-23 17:39:04 +01:00

43 lines
1.7 KiB
TypeScript

import { render, screen, waitFor } from '@testing-library/react';
import Projects from '@/app/components/Projects';
import '@testing-library/jest-dom';
import { mockFetch } from '@/app/__tests__/__mocks__/mock-fetch';
describe('Projects', () => {
beforeAll(() => {
process.env.GHOST_API_URL = 'http://localhost:2368';
process.env.GHOST_API_KEY = 'some-key';
global.fetch = mockFetch({
posts: [
{
id: '67ac8dfa709c60000117d312',
title: 'Just Doing Some Testing',
meta_description: 'Hello bla bla bla bla',
slug: 'just-doing-some-testing',
updated_at: '2025-02-13T14:25:38.000+00:00',
},
{
id: '67aaffc3709c60000117d2d9',
title: 'Blockchain Based Voting System',
meta_description: 'This project aims to revolutionize voting systems by leveraging blockchain to ensure security, transparency, and immutability.',
slug: 'blockchain-based-voting-system',
updated_at: '2025-02-13T16:54:42.000+00:00',
},
],
});
});
it('renders the projects section', async () => {
render(<Projects />);
expect(await screen.findByText('Projects')).toBeInTheDocument();
await waitFor(() => {
expect(screen.getByText('Just Doing Some Testing')).toBeInTheDocument();
expect(screen.getByText('Hello bla bla bla bla')).toBeInTheDocument();
expect(screen.getByText('Blockchain Based Voting System')).toBeInTheDocument();
expect(screen.getByText('This project aims to revolutionize voting systems by leveraging blockchain to ensure security, transparency, and immutability.')).toBeInTheDocument();
});
});
});