fix: tests de date et suppression fichier test vide
This commit is contained in:
@@ -150,7 +150,7 @@ describe('Export Utils', () => {
|
|||||||
const filename = formatFilename('Campagne avec des caractères spéciaux @#$%');
|
const filename = formatFilename('Campagne avec des caractères spéciaux @#$%');
|
||||||
|
|
||||||
expect(filename).toMatch(/^statistiques_vote_campagne_avec_des_caractres_spciaux_\d{4}-\d{2}-\d{2}\.ods$/);
|
expect(filename).toMatch(/^statistiques_vote_campagne_avec_des_caractres_spciaux_\d{4}-\d{2}-\d{2}\.ods$/);
|
||||||
expect(filename).toContain('2025-08-27');
|
expect(filename).toMatch(/\d{4}-\d{2}-\d{2}/); // Vérifie qu'il y a une date
|
||||||
expect(filename).not.toContain('__'); // Pas d'underscores doubles
|
expect(filename).not.toContain('__'); // Pas d'underscores doubles
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ describe('Export Utils', () => {
|
|||||||
const filename = formatFilename('');
|
const filename = formatFilename('');
|
||||||
|
|
||||||
expect(filename).toMatch(/^statistiques_vote_\d{4}-\d{2}-\d{2}\.ods$/);
|
expect(filename).toMatch(/^statistiques_vote_\d{4}-\d{2}-\d{2}\.ods$/);
|
||||||
expect(filename).toContain('2025-08-27');
|
expect(filename).toMatch(/\d{4}-\d{2}-\d{2}/); // Vérifie qu'il y a une date
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
import React, { ReactElement } from 'react';
|
|
||||||
import { render, RenderOptions } from '@testing-library/react';
|
|
||||||
|
|
||||||
// Mock data pour les tests
|
|
||||||
export const mockCampaign = {
|
|
||||||
id: 'test-campaign-id',
|
|
||||||
title: 'Test Campaign',
|
|
||||||
description: 'Test campaign description',
|
|
||||||
status: 'deposit' as const,
|
|
||||||
budget_per_user: 100,
|
|
||||||
spending_tiers: '10,25,50,100',
|
|
||||||
slug: 'test-campaign',
|
|
||||||
created_at: '2024-01-01T00:00:00Z',
|
|
||||||
updated_at: '2024-01-01T00:00:00Z',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mockParticipant = {
|
|
||||||
id: 'test-participant-id',
|
|
||||||
campaign_id: 'test-campaign-id',
|
|
||||||
first_name: 'John',
|
|
||||||
last_name: 'Doe',
|
|
||||||
email: 'john.doe@example.com',
|
|
||||||
short_id: 'abc123',
|
|
||||||
created_at: '2024-01-01T00:00:00Z',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mockProposition = {
|
|
||||||
id: 'test-proposition-id',
|
|
||||||
campaign_id: 'test-campaign-id',
|
|
||||||
title: 'Test Proposition',
|
|
||||||
description: 'Test proposition description',
|
|
||||||
author_first_name: 'Jane',
|
|
||||||
author_last_name: 'Smith',
|
|
||||||
author_email: 'jane.smith@example.com',
|
|
||||||
created_at: '2024-01-01T00:00:00Z',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mockVote = {
|
|
||||||
id: 'test-vote-id',
|
|
||||||
campaign_id: 'test-campaign-id',
|
|
||||||
participant_id: 'test-participant-id',
|
|
||||||
proposition_id: 'test-proposition-id',
|
|
||||||
amount: 50,
|
|
||||||
created_at: '2024-01-01T00:00:00Z',
|
|
||||||
updated_at: '2024-01-01T00:00:00Z',
|
|
||||||
};
|
|
||||||
|
|
||||||
// Wrapper pour les tests avec providers
|
|
||||||
const AllTheProviders = ({ children }: { children: React.ReactNode }) => {
|
|
||||||
return <>{children}</>;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Custom render function avec providers
|
|
||||||
const customRender = (
|
|
||||||
ui: ReactElement,
|
|
||||||
options?: Omit<RenderOptions, 'wrapper'>
|
|
||||||
) => render(ui, { wrapper: AllTheProviders, ...options });
|
|
||||||
|
|
||||||
// Re-export everything
|
|
||||||
export * from '@testing-library/react';
|
|
||||||
export { customRender as render };
|
|
||||||
Reference in New Issue
Block a user