import { render, screen } from '@testing-library/react';
import { getScopedI18n } from '@/i18n/server';
import ProfileNotFound from './not-found';

vi.mock('@/i18n/server', () => ({
    getScopedI18n: vi.fn().mockReturnValue((term: string) => term),
}));

vi.mock('@/assets/warning.svg', () => ({ default: 'warning.svg' }));

describe('<ProfileNotFound>', () => {
    describe('scoped i18n', () => {
        it('should recieve correct arguments', async () => {
            render(await ProfileNotFound());

            expect(getScopedI18n).toHaveBeenCalledWith('pages.profile');
        });
    });

    it('should render icon', async () => {
        render(await ProfileNotFound());

        expect(screen.getByRole('presentation')).toBeVisible();
        expect(screen.getByRole('presentation')).toHaveAttribute(
            'src',
            expect.stringMatching(/warning.svg/)
        );
    });

    it('should render title', async () => {
        render(await ProfileNotFound());

        expect(screen.getByText('notFound.title')).toBeVisible();
    });

    it('should render message', async () => {
        render(await ProfileNotFound());

        expect(screen.getByText('notFound.message')).toBeVisible();
    });
});
