veza/apps/web/src/components/admin/AdminSettingsView.stories.tsx
senke 8e9ee2f3a5 fix: stabilize builds, tests, and lint across all stacks
Complete stabilization pass bringing all 3 stacks to green:

Frontend (apps/web/):
- Fix TypeScript nullability in useSeason.ts, useTimeOfDay.ts hooks
- Disable no-undef in ESLint config (TypeScript handles it; JSX misidentified)
- Rename 306 story imports from @storybook/react to @storybook/react-vite
- Fix conditional hook call in useMediaQuery.ts useIsTablet
- Move useQuery to top of LoginPage.tsx component
- Remove useless try/catch in GearFormModal.tsx
- Fix stale closure in ResetPasswordPage.tsx handleChange
- Make Storybook decorators (withRouter, withQueryClient, withToast, withAudio)
  no-ops since global StorybookDecorator already provides these — prevents
  nested Router / duplicate provider crashes in vitest-browser
- Fix nested MemoryRouter in 3 page stories (TrackDetail, PlaylistDetail, UserProfile)
- Update i18n initialization in test setup (await init before changeLanguage)
- Update ~30 test assertions from English to French to match i18n translations
- Update test assertions to match SUMI V3 design changes (shadow vs border)
- Fix remaining story type errors (PlayerError, PlaylistBatchActions,
  TrackFilters, VirtualizedChatMessages)

Backend (veza-backend-api/):
- Fix response_test.go RespondWithAppError signature (2 args, not 3)
- Fix TestErrorContractAuthEndpoints expected error codes
  (ErrCodeUnauthorized vs ErrCodeInvalidCredentials)
- Fix TestTrackHandler_GetTrackLikes_Success missing auth middleware setup
- Fix TestPlaybackAnalyticsService_GetTrackStats k-anonymity threshold
  (needs 5 unique users, not 1)
- Replace NOW() PostgreSQL function with time.Now() parameter in marketplace
  service for SQLite test compatibility
- Add missing AutoMigrate entries in marketplace_test.go
  (ProductImage, ProductPreview, ProductLicense, ProductReview)

Results:
- Frontend TypeCheck: 617 errors -> 0 errors
- Frontend ESLint: 349 errors -> 0 errors
- Frontend Vitest: 196 failing tests -> 1 skipped (3396/3397 passing)
- Backend go vet: 1 error -> 0 errors
- Backend tests: 5 failing -> all 13 packages passing
- Rust: 150/150 tests passing (unchanged)
- Storybook audit: 0 errors across 1244 stories

Triage report: docs/TRIAGE_REPORT.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 16:48:07 +02:00

114 lines
3.1 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react-vite';
import { http, HttpResponse } from 'msw';
import { AdminSettingsView } from './AdminSettingsView';
/**
* AdminSettingsView - Paramètres système
*
* Interface de configuration système avec feature flags,
* mode maintenance et annonces globales.
*/
const meta: Meta<typeof AdminSettingsView> = {
title: 'Components/Features/Admin/AdminSettingsView',
component: AdminSettingsView,
parameters: {
layout: 'padded',
docs: {
description: {
component: 'Configuration système admin avec feature flags et mode maintenance.',
},
},
},
tags: ['autodocs'],
decorators: [
(Story) => (
<div className="bg-background min-h-screen p-4">
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof meta>;
/**
* État par défaut des paramètres.
*/
export const Default: Story = {
name: 'Par défaut',
};
/**
* État de chargement.
*/
export const Loading: Story = {
name: 'Chargement',
parameters: {
msw: {
handlers: [
http.get('*/api/v1/admin/maintenance', async () => {
await new Promise(() => {});
return HttpResponse.json({ maintenance_mode: false });
}),
http.get('*/api/v1/admin/feature-flags', async () => {
await new Promise(() => {});
return HttpResponse.json({ feature_flags: [] });
}),
http.get('*/api/v1/admin/announcements', async () => {
await new Promise(() => {});
return HttpResponse.json({ announcements: [] });
}),
],
},
docs: {
description: {
story: 'Skeleton pendant le chargement des paramètres.',
},
},
},
};
/**
* État d'erreur.
*/
export const Error: Story = {
name: 'Erreur',
parameters: {
msw: {
handlers: [
http.get('*/api/v1/admin/maintenance', () =>
HttpResponse.json({ error: 'Server error' }, { status: 500 })),
http.get('*/api/v1/admin/feature-flags', () =>
HttpResponse.json({ error: 'Server error' }, { status: 500 })),
http.get('*/api/v1/admin/announcements', () =>
HttpResponse.json({ error: 'Server error' }, { status: 500 })),
],
},
docs: {
description: {
story: 'Affichage en cas d\'échec du chargement.',
},
},
},
};
/**
* Annonces vides.
*/
export const EmptyAnnouncements: Story = {
name: 'Sans annonces',
parameters: {
msw: {
handlers: [
http.get('*/api/v1/admin/announcements', () =>
HttpResponse.json({ announcements: [] })),
],
},
docs: {
description: {
story: 'Aucune annonce configurée.',
},
},
},
};