Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

gemini-native-thinking-grammar.test.ts

38 lines1.4 KB

1import { expect, it } from 'vitest'
2import docs from './fixtures/gemini-native-thinking-grammar.json'
3import { parsePageThinking } from './gemini-features.ts'
4​
5it('reads native conjunction lists without inventing levels', () => {
6 expect(parsePageThinking(docs['gemini-3.1-flash-lite-image'])).toEqual({
7 mode: 'effort',
8 mandatory: null,
9 efforts: ['minimal', 'high'],
10 })
11})
12it('keeps native interleaved reasoning controls unknown when configuration is unsupported', () => {
13 expect(docs['gemini-3.8-live']).toContain('`thinking_level` is not supported')
14 expect(parsePageThinking(docs['gemini-3.8-live'])).toBeNull()
15})
16it('rejects unknown declared levels and ignores fenced declarations', () => {
17 expect(() =>
18 parsePageThinking(
19 docs['gemini-3.1-flash-lite-image'].replace(
20 'minimal and high',
21 'minimal and imaginary',
22 ),
23 ),
24 ).toThrow()
25 expect(
26 parsePageThinking('```\n' + docs['gemini-3.1-flash-lite-image'] + '\n```'),
27 ).toBeNull()
28})
29it('reads a deprecated page that names minimal as unsupported (#432)', () => {
30 // The Capabilities cell of models/gemini-3.7-flash.md.txt on 2026-10-23.
31 const cell =
32 '| Capabilities | **[Thinking](https://ai.google.dev/gemini-api/docs/thinking)** Supported (low, medium, high) Note: `minimal` is not supported and returns an error. |'
33 expect(parsePageThinking(cell)).toEqual({
34 mode: 'effort',
35 mandatory: null,
36 efforts: ['low', 'medium', 'high'],
37 })
38})