tests
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user