diff --git a/app/api/collections/[collection]/records/route.ts b/app/api/collections/[collection]/records/route.ts index 2c24ab6..1d235f2 100644 --- a/app/api/collections/[collection]/records/route.ts +++ b/app/api/collections/[collection]/records/route.ts @@ -5,6 +5,74 @@ export const dynamic = 'force-static'; const base = { created: '', updated: '' }; const FIXTURES: Record = { + site_settings: [ + { + id: 'ss1', + collectionId: 'site_settings', + collectionName: 'site_settings', + ...base, + cv: '', + contacts: 'c1', + expand: { + contacts: { + id: 'c1', + collectionId: 'contacts', + collectionName: 'contacts', + ...base, + email: 'hello@allmy.work', + socials: ['s1', 's2'], + expand: { + socials: [ + { + id: 's1', + collectionId: 'contact', + collectionName: 'contact', + ...base, + label: 'GitHub', + url: 'https://github.com', + }, + { + id: 's2', + collectionId: 'contact', + collectionName: 'contact', + ...base, + label: 'LinkedIn', + url: 'https://linkedin.com', + }, + ], + }, + }, + }, + }, + ], + contacts: [ + { + id: 'c1', + collectionId: 'contacts', + collectionName: 'contacts', + ...base, + email: 'hello@allmy.work', + socials: ['s1', 's2'], + }, + ], + contact: [ + { + id: 's1', + collectionId: 'contact', + collectionName: 'contact', + ...base, + label: 'GitHub', + url: 'https://github.com', + }, + { + id: 's2', + collectionId: 'contact', + collectionName: 'contact', + ...base, + label: 'LinkedIn', + url: 'https://linkedin.com', + }, + ], sections: [ { id: '1', diff --git a/src/widgets/Footer/ui/Footer/Footer.test.tsx b/src/widgets/Footer/ui/Footer/Footer.test.tsx index b7afc0f..e31eb90 100644 --- a/src/widgets/Footer/ui/Footer/Footer.test.tsx +++ b/src/widgets/Footer/ui/Footer/Footer.test.tsx @@ -1,47 +1,147 @@ +vi.mock('$shared/api', () => ({ + getFirstRecord: vi.fn(), +})); + import { render, screen } from '@testing-library/react'; +import { getFirstRecord } from '$shared/api'; import { Footer } from './Footer'; +const mockSettings = { + id: 'ss1', + collectionId: 'site_settings', + collectionName: 'site_settings', + created: '', + updated: '', + cv: 'cv_2024.pdf', + contacts: 'c1', + expand: { + contacts: { + id: 'c1', + collectionId: 'contacts', + collectionName: 'contacts', + created: '', + updated: '', + email: 'hello@allmy.work', + socials: ['s1'], + expand: { + socials: [ + { + id: 's1', + collectionId: 'contact', + collectionName: 'contact', + created: '', + updated: '', + label: 'GitHub', + url: 'https://github.com', + }, + ], + }, + }, + }, +}; + describe('Footer', () => { + beforeEach(() => { + vi.mocked(getFirstRecord).mockResolvedValue(mockSettings); + }); + describe('structure', () => { - it('renders a footer element', () => { - const { container } = render(