All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 24s
Build & Deploy / 🧪 QA (push) Successful in 1m9s
Build & Deploy / 🏗️ Build (push) Successful in 2m49s
Build & Deploy / 🚀 Deploy (push) Successful in 26s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 45s
Build & Deploy / 🔔 Notify (push) Successful in 2s
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
import ReferenceDetail from './page';
|
|
|
|
// Mock next/navigation
|
|
vi.mock('next/navigation', () => ({
|
|
notFound: vi.fn(),
|
|
}));
|
|
|
|
// Mock next-intl/server
|
|
vi.mock('next-intl/server', () => ({
|
|
setRequestLocale: vi.fn(),
|
|
getTranslations: vi.fn().mockResolvedValue(() => 'translated text'),
|
|
}));
|
|
|
|
// Mock @/lib/references
|
|
vi.mock('@/lib/references', () => ({
|
|
getReferenceBySlug: vi.fn().mockResolvedValue({
|
|
slug: 'test-slug',
|
|
frontmatter: {
|
|
title: 'Test Title',
|
|
location: 'Test Location',
|
|
category: 'Test Category',
|
|
},
|
|
content: 'Test content',
|
|
}),
|
|
}));
|
|
|
|
describe('ReferenceDetail Page TDD', () => {
|
|
it('renders reference detail correctly', async () => {
|
|
const props = {
|
|
params: Promise.resolve({ locale: 'de', slug: 'test-slug' })
|
|
};
|
|
|
|
// We expect the execution to fail if getTranslations is not defined/imported inside page.tsx
|
|
const component = await ReferenceDetail(props);
|
|
expect(component).toBeTruthy();
|
|
});
|
|
});
|