Spaces:
Sleeping
Sleeping
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; | |
| import { buildGenerationResponse } from './generation.js'; | |
| describe('buildGenerationResponse', () => { | |
| beforeEach(() => { | |
| vi.stubGlobal('crypto', { randomUUID: vi.fn(() => 'id') }); | |
| }); | |
| afterEach(() => { | |
| vi.unstubAllGlobals(); | |
| }); | |
| it('creates queued variants for each image', () => { | |
| const response = buildGenerationResponse( | |
| { prompt: 'Photorealistic bottle', preset: 'studio', ratio: '16:9', mode: 'product' }, | |
| [{ originalName: 'bottle.png', mimeType: 'image/png', size: 1000 }], | |
| ); | |
| expect(response).toMatchObject({ | |
| jobId: 'id', | |
| provider: 'mock', | |
| preset: 'studio', | |
| ratio: '16:9', | |
| images: [ | |
| { | |
| id: 'id', | |
| originalName: 'bottle.png', | |
| variants: [ | |
| { id: 'id', label: 'Clean studio', status: 'queued' }, | |
| { id: 'id', label: 'Warme food sfeer', status: 'queued' }, | |
| { id: 'id', label: 'Premium donker', status: 'queued' }, | |
| ], | |
| }, | |
| ], | |
| }); | |
| }); | |
| }); | |