- chatService: getChannels → getServers - commerceService: getOrders/getOrderDetails/getSalesStats → getPurchases/getSellerStats - marketplaceService: mock réponse, params API, getDownloadLink → listOrders - config/env.test: vi.stubEnv, import dynamique - useAuth.test: mock useAuthStore - TrackStatsDisplay, UploadQuota: mock du bon service (analyticsService, uploadService) - TrackListEmpty, TrackListRow, TrackSearch: design tokens, assertions - trackDownloadService, chunkedUploadService: MSW/server.use - trackListService, trackSearchService, trackShareService: assertions - ErrorBoundary, LoginForm, PlaylistErrorBoundary, PlaylistRecommendations - RAPPORT_RESOLUTION_TESTS_CYCLE1.md Co-authored-by: Cursor <cursoragent@cursor.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
import { chatService } from './chatService';
|
|
|
|
describe('chatService', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
describe('getServers', () => {
|
|
it('should return servers with channels', async () => {
|
|
const servers = await chatService.getServers();
|
|
|
|
expect(servers).toBeDefined();
|
|
expect(Array.isArray(servers)).toBe(true);
|
|
expect(servers.length).toBeGreaterThan(0);
|
|
expect(servers[0]).toHaveProperty('categories');
|
|
});
|
|
});
|
|
|
|
describe('getDMs', () => {
|
|
it('should return direct messages', async () => {
|
|
const dms = await chatService.getDMs();
|
|
|
|
expect(dms).toBeDefined();
|
|
expect(Array.isArray(dms)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('getMessages', () => {
|
|
it('should return messages for a channel', async () => {
|
|
const messages = await chatService.getMessages('channel-1');
|
|
|
|
expect(messages).toBeDefined();
|
|
expect(Array.isArray(messages)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('sendMessage', () => {
|
|
it('should send a message successfully', async () => {
|
|
const result = await chatService.sendMessage('channel-1', {
|
|
content: 'Test message',
|
|
});
|
|
|
|
expect(result).toBeDefined();
|
|
expect(result).toHaveProperty('id');
|
|
expect(result).toHaveProperty('sender');
|
|
expect(result).toHaveProperty('content');
|
|
});
|
|
});
|
|
});
|