Skip to content

Commit

Permalink
Refactor App.test.js to test Work component for current year
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkan1 committed Feb 12, 2024
1 parent ed0b9dd commit e0edb2d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
//import App from './App';
import Work from './pages/Work';

test('if the copyright is for latest year', () => {
test('if I have at least one project for this year', () => {
const currentYear = new Date().getFullYear().toString()
const { getByText } = render(<App />);
const linkElement = getByText(currentYear, { exact: false });
expect(linkElement).toBeInTheDocument();
// const getByTextApp = render(<App />).getByText;
const getByTextWork = render(<Work />).getByText;
// const linkElementApp = getByTextApp(currentYear, { exact: false });
const linkElementWork = getByTextWork(currentYear, { exact: false });
expect(linkElementWork).toBeInTheDocument();
});

0 comments on commit e0edb2d

Please sign in to comment.