Open History to see the last commit
1import { test, expect } from './fixtures'
2
3interface StageResult {
4 imageCount?: number
5 error?: string
6}
7
8interface GeminiImageGaModelsResponse {
9 gaModelListed: boolean
10 gaModel: StageResult
11 nanoBanana21: StageResult
12 legacyModel: StageResult
13}
14
15/**
16 * Regression coverage for #1104 (Gemini GA image model ids + per-model
17 * sizes). See `api.gemini-image-ga-models.ts` for the full mechanism and
18 * `geminiNativeImageMount` in `global-setup.ts` for the mock that makes it
19 * possible — aimock's `/v1beta/interactions` handler streams text and has no
20 * image branch, so this route/mount pair exists specifically to cover what
21 * aimock alone cannot. The route runs both model calls as independent
22 * stages, so each test below only depends on its own stage.
23 */
24test.describe('gemini — GA image model ids and per-model sizes (#1104)', () => {
25 test('gemini-3.1-flash-image is a listed GA id and generates an image', async ({
26 request,
27 }) => {
28 const res = await request.post('/api/gemini-image-ga-models')
29 expect(res.ok()).toBe(true)
30
31 const { gaModelListed, gaModel } =
32 (await res.json()) as GeminiImageGaModelsResponse
33
34 // Genuine runtime data, not a type check: `GeminiImageModels` is the
35 // package's exported `as const` array of supported image model ids.
36 // Nothing at runtime gates request routing on this array (the adapter
37 // dispatches on `GEMINI_NATIVE_IMAGE_MODELS` membership), so checking
38 // its contents is the only way to observe the id addition without a
39 // TypeScript compile step. Before #1104 the array only carried the
40 // shut-down `gemini-3.1-flash-image-preview` alias.
41 expect(gaModelListed).toBe(true)
42 expect(gaModel.error ?? null).toBeNull()
43 expect(gaModel.imageCount).toBe(1)
44 })
45
46 test('gemini-nano-banana-2.1 routes to Interactions with aspect_ratio and image_size (#1640)', async ({
47 request,
48 }) => {
49 const res = await request.post('/api/gemini-image-ga-models')
50 expect(res.ok()).toBe(true)
51
52 const { nanoBanana21 } = (await res.json()) as GeminiImageGaModelsResponse
53
54 expect(nanoBanana21.error ?? null).toBeNull()
55 expect(nanoBanana21.imageCount).toBe(1)
56 })
57
58 test('gemini-2.5-flash-image sends aspect_ratio and omits image_size', async ({
59 request,
60 }) => {
61 const res = await request.post('/api/gemini-image-ga-models')
62 expect(res.ok()).toBe(true)
63
64 const { legacyModel } = (await res.json()) as GeminiImageGaModelsResponse
65
66 expect(legacyModel.error ?? null).toBeNull()
67 expect(legacyModel.imageCount).toBe(1)
68 })
69})