import { http, HttpResponse } from 'msw' import { jsonResponse } from '../helpers' // Default `/api/resource/*` handlers — image / thumbnail / video binary serving. // Returns a tiny PNG stub for any image request so layout tests can mount // without 404 noise. const ONE_PX_PNG = Uint8Array.from([ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x15, 0xc4, 0x89, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x62, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x01, 0x0d, 0x0a, 0x2d, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, ]) export const resourceHandlers = [ http.get('/api/resource/images/:name', () => new HttpResponse(ONE_PX_PNG, { headers: { 'Content-Type': 'image/png' } }), ), http.get('/api/resource/thumbnails/:name', () => new HttpResponse(ONE_PX_PNG, { headers: { 'Content-Type': 'image/png' } }), ), http.get('/api/resource/videos/:name', () => jsonResponse({ url: '/api/resource/videos/stub.mp4' }), ), ]