Skip to content
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

499-refactor: Widget alumni #501

Merged
merged 13 commits into from
Sep 27, 2024
46 changes: 1 addition & 45 deletions src/widgets/alumni/ui/alumni.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { render, screen } from '@testing-library/react';
import { Mock, describe, expect, it, vi } from 'vitest';
import { describe, expect, it } from 'vitest';
import { Alumni } from './alumni';
import { useWindowSize } from '@/shared/hooks/use-window-size';

vi.mock('@/shared/hooks/use-window-size', () => ({
useWindowSize: vi.fn().mockReturnValue({
width: 2000,
height: 2000,
}),
}),
);

describe('Alumni', () => {
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
it('renders the title correctly', () => {
Expand All @@ -25,39 +16,4 @@ describe('Alumni', () => {

expect(paragraphElement).toBeInTheDocument();
});

it('renders six images for small screens', () => {
// vi.mockImplementation(() => ({ width: 800, height: 600 }));
(useWindowSize as Mock).mockReturnValue({
width: 800,
height: 600,
});
render(<Alumni />);
const imageElements = screen.getAllByRole('img');

expect(imageElements).toHaveLength(6);
});

it('renders twelve images for medium screens', () => {
(useWindowSize as Mock).mockReturnValue({
width: 1440,
height: 900,
});
render(<Alumni />);
const imageElements = screen.getAllByRole('img');

expect(imageElements).toHaveLength(12);
});

it('renders all images for large screens', () => {
(useWindowSize as Mock).mockReturnValue({
width: 2000,
height: 2000,
});
render(<Alumni />);

const imageElements = screen.getAllByRole('img');

expect(imageElements).toHaveLength(18);
});
});