file re-org
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 53s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 53s
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
// src/components/AnonymousUserBanner.test.tsx
|
||||
import React from 'react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { AnonymousUserBanner } from './AnonymousUserBanner';
|
||||
|
||||
describe('AnonymousUserBanner', () => {
|
||||
it('should render the banner with the correct text content', () => {
|
||||
const mockOnOpenProfile = vi.fn();
|
||||
render(<AnonymousUserBanner onOpenProfile={mockOnOpenProfile} />);
|
||||
|
||||
expect(screen.getByText(/you're viewing as a guest/i)).toBeInTheDocument();
|
||||
expect(screen.getByText(/to save your flyers, create a watchlist, and access more features/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /sign up or log in/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should call onOpenProfile when the "sign up or log in" button is clicked', () => {
|
||||
const mockOnOpenProfile = vi.fn();
|
||||
render(<AnonymousUserBanner onOpenProfile={mockOnOpenProfile} />);
|
||||
|
||||
const loginButton = screen.getByRole('button', { name: /sign up or log in/i });
|
||||
fireEvent.click(loginButton);
|
||||
|
||||
expect(mockOnOpenProfile).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user