-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mai/Fix-413-added in Link to logo #446
Changes from 8 commits
467fb0c
cd68786
85642ea
eb39712
6d69e43
8e71a95
9c836f0
8f866f6
74f8316
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { render, screen, fireEvent, waitFor } from '@testing-library/react'; | ||
import LogoNav from './LogoNav'; | ||
|
||
describe('LogoNav Component', () => { | ||
it('renders the logo and links to the /league/all page', () => { | ||
render(<LogoNav />); | ||
|
||
const logoImage = screen.getByTestId('logo-nav'); | ||
expect(logoImage).toBeInTheDocument(); | ||
|
||
const linkElement = screen.getByRole('link', { | ||
name: /Gridiron Survivor logo/i, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General question, what's the forward-slashes and "i" do here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ryandotfurrer it's regex to look for the specific word of 'Gridiron Survivor Logo'. Here's a great blog about the i in Regex: https://www.w3schools.com/jsref/jsref_regexp_i.asp. Please let me know if this makes sense :) |
||
}); | ||
expect(linkElement).toHaveAttribute('href', '/league/all'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to use the datatest-id of
logo-nav
here instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
data-testid="logo-nav"
is currently used for the Image tag. I like the idea of adding a data-testID to test the Link tag and will implement one shortly.