front/__tests__/NavButton.test.tsx
2024-10-19 08:16:51 +03:00

17 lines
566 B
TypeScript

import React from 'react';
import { render, screen } from '@testing-library/react';
import NavButton from '../src/components/init/NavButton.jsx';
describe('NavButton Component', () => {
it('should render the NavButton with the correct text and link', () => {
const navLink = '/home';
const buttonText = 'Go Home';
render(<NavButton nav={navLink} text={buttonText} />);
const linkElement = screen.getByText(buttonText);
expect(linkElement).toBeInTheDocument();
expect(linkElement.closest('a')).toHaveAttribute('href', navLink);
});
});