-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
97 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
frontend/src/components/static-site/nav-auction-icons.spec.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { mockTrack } from 'tests/mocks'; | ||
import { render, screen, waitFor } from 'tests/test-utils'; | ||
|
||
import { NavIcons, NavigationTabs } from '@/components/static-site/nav-icons'; | ||
|
||
describe('NavIcons Tests', () => { | ||
global.open = vi.fn(); | ||
it('should render a list of icons', () => { | ||
render(<NavIcons />); | ||
for (const iconData of NavigationTabs) { | ||
const icon = screen.getByTestId(`${iconData.name}-btn`); | ||
expect(icon).toBeInTheDocument(); | ||
} | ||
}); | ||
|
||
it('should call track analytics when an icon is clicked', async () => { | ||
render(<NavIcons />); | ||
const icon = screen.getByTestId(`${NavigationTabs[0].name}-btn`); | ||
icon.click(); | ||
await waitFor(() => { | ||
expect(mockTrack).toHaveBeenCalledWith( | ||
`${NavigationTabs[0].name.charAt(0).toUpperCase() + NavigationTabs[0].name.split('-')[0].slice(1)} Clicked`, | ||
expect.any(Object), | ||
expect.any(Object), | ||
); | ||
}); | ||
}); | ||
|
||
it('should call window open on click', async () => { | ||
render(<NavIcons />); | ||
const icon = screen.getByTestId(`${NavigationTabs[0].name}-btn`); | ||
icon.click(); | ||
await waitFor(() => { | ||
expect(window.open).toHaveBeenCalledWith(NavigationTabs[0].url); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.