From 88fa637ac1aa0655dd3c2a866fb02f2913d328db Mon Sep 17 00:00:00 2001 From: Yannick Le Duc Date: Fri, 29 Aug 2025 09:43:58 +0200 Subject: [PATCH] =?UTF-8?q?am=C3=A9lioration=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__tests__/components/Footer.test.tsx | 144 ++++++++++++++++ src/__tests__/components/Navigation.test.tsx | 103 ++++++++++++ src/__tests__/lib/file-utils.test.ts | 163 +++++++++++++++++++ src/lib/file-utils.ts | 66 +++++++- 4 files changed, 471 insertions(+), 5 deletions(-) create mode 100644 src/__tests__/components/Footer.test.tsx create mode 100644 src/__tests__/components/Navigation.test.tsx create mode 100644 src/__tests__/lib/file-utils.test.ts diff --git a/src/__tests__/components/Footer.test.tsx b/src/__tests__/components/Footer.test.tsx new file mode 100644 index 0000000..18ab745 --- /dev/null +++ b/src/__tests__/components/Footer.test.tsx @@ -0,0 +1,144 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import Footer from '../../components/Footer'; + +// Mock des dépendances +jest.mock('@/lib/project.config', () => ({ + PROJECT_CONFIG: { + repository: { + url: 'https://github.com/example/repo' + } + } +})); + +jest.mock('@/lib/services', () => ({ + settingsService: { + getStringValue: jest.fn().mockResolvedValue('Développé avec ❤️ pour faciliter la démocratie participative - [Logiciel libre et open source](GITURL) et transparent pour tous') + } +})); + +describe('Footer', () => { + beforeEach(() => { + // Mock des variables d'environnement + process.env.NEXT_PUBLIC_SUPABASE_URL = 'https://test.supabase.co'; + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = 'test-key'; + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + it('should render footer with basic content', async () => { + render(