veza/apps/web/src/mocks/handlers.ts

53 lines
2 KiB
TypeScript

/**
* FE-API-019: MSW Mock Handlers
* Mock request handlers for development and testing
*
* Handlers are split by feature:
* - handlers-common: external images, csrf
* - handlers-auth: auth, 2fa, sessions
* - handlers-admin: audit, dashboard, roles, users list, monitoring, webhooks, api-keys
* - handlers-social: social feed, posts, groups
* - handlers-marketplace: marketplace, commerce, cart, orders
* - handlers-tracks: tracks, comments
* - handlers-playlists: playlists
* - handlers-misc: search, notifications, users profile, chat, streaming, inventory, live
* - handlers-cloud: cloud storage, folders, files, quota
* - handlers-colistening: co-listening sessions (v0.10.7 F481)
*/
import { http, HttpResponse } from 'msw';
import { handlersCommon } from './handlers-common';
import { handlersAuth } from './handlers-auth';
import { handlersAdmin } from './handlers-admin';
import { handlersSocial } from './handlers-social';
import { handlersMarketplace } from './handlers-marketplace';
import { handlersTracks } from './handlers-tracks';
import { handlersPlaylists } from './handlers-playlists';
import { handlersMisc } from './handlers-misc';
import { handlersDiscover } from './handlers-discover';
import { handlersCloud } from './handlers-cloud';
import { handlersStreaming } from './handlers-streaming';
import { handlersLive } from './handlers-live';
import { handlersColistening } from './handlers-colistening';
export const handlers = [
...handlersCommon,
...handlersAuth,
...handlersAdmin,
...handlersSocial,
...handlersMarketplace,
...handlersTracks,
...handlersPlaylists,
...handlersMisc,
...handlersDiscover,
...handlersCloud,
...handlersStreaming,
...handlersLive,
...handlersColistening,
// Catch-all for API to prevent network leaks (Phase 1: Stabilization)
http.all('*/api/v1/*', ({ request }) => {
console.warn('[MSW] Intercepted unhandled API request:', request.method, request.url);
return HttpResponse.json({ success: true, message: 'Mocked fallback response from Storybook' });
}),
];