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

deprecations.test.ts

150 lines4.7 KB

1import { readFileSync } from 'node:fs'
2​
3import { describe, expect, it } from 'vitest'
4​
5import {
6 GROQ_DEPRECATIONS_URL,
7 MISTRAL_DEPRECATIONS_URL,
8 parseGroqDeprecations,
9 parseMistralDeprecations,
10} from './deprecations.ts'
11​
12// Fetched 2026-10-22: https://console.groq.com/docs/deprecations.md and
13// https://docs.mistral.ai/models.md.
14const GROQ = readFileSync(
15 new URL('./fixtures/groq-deprecations.md.txt', import.meta.url),
16 'utf8',
18const MISTRAL = readFileSync(
19 new URL('./fixtures/mistral-models.md.txt', import.meta.url),
20 'utf8',
22​
23const day = (iso: string) => Date.parse(`${iso}T00:00:00Z`) / 1000
24​
25describe('groq deprecations page', () => {
26 const rows = new Map(parseGroqDeprecations(GROQ).map((r) => [r.rawId, r]))
27​
28 it('reads every id issue #410 names, with shutdown date and replacements', () => {
29 expect(rows.get('llama-3.3-70b-versatile')).toEqual({
30 rawId: 'llama-3.3-70b-versatile',
31 deprecatedAt: day('2026-06-17'),
32 retiresAt: day('2026-08-16'),
33 replacedBy: ['openai/gpt-oss-120b', 'qwen/qwen3.6-27b'],
34 sourceUrl: GROQ_DEPRECATIONS_URL,
35 })
36 expect(rows.get('meta-llama/llama-4-maverick-17b-128e-instruct')).toEqual(
37 expect.objectContaining({
38 deprecatedAt: day('2026-02-20'),
39 retiresAt: day('2026-03-09'),
40 replacedBy: ['openai/gpt-oss-120b'],
41 }),
42 )
43 for (const id of [
44 'llama-3.1-8b-instant',
45 'meta-llama/llama-4-scout-17b-16e-instruct',
46 'meta-llama/llama-guard-4-12b',
47 'moonshotai/kimi-k2-instruct-0905',
48 'qwen/qwen3-32b',
49 ]) {
50 expect(rows.get(id)?.retiresAt).toBeTypeOf('number')
51 }
52 })
53​
54 it('states no replacement for a dash, and no date where the prose has none', () => {
55 expect(rows.get('groq/compound')).toEqual(
56 expect.objectContaining({
57 deprecatedAt: day('2026-08-24'),
58 retiresAt: day('2026-09-21'),
59 replacedBy: null,
60 }),
61 )
62 // "we are announcing": no announcement date stated.
63 expect(rows.get('mistral-saba-24b')?.deprecatedAt).toBeNull()
64 // "In November 2024": a month, not a day.
65 expect(rows.get('llama-3.2-90b-text-preview')).toEqual(
66 expect.objectContaining({
67 deprecatedAt: null,
68 replacedBy: ['llama-3.2-90b-vision-preview', 'llama-3.1-70b-versatile'],
69 }),
70 )
71 })
72​
73 it('keeps the newest entry for an id listed twice', () => {
74 expect(rows.get('deepseek-r1-distill-llama-70b-specdec')?.retiresAt).toBe(
75 day('2025-04-14'),
76 )
77 })
78​
79 it('throws on a cell it cannot read', () => {
80 expect(() =>
81 parseGroqDeprecations(
82 GROQ.replace(
83 '| openai/gpt-oss-safeguard-20b ',
84 '| none ',
85 ),
86 ),
87 ).toThrow(/replacement id/)
88 expect(() =>
89 parseGroqDeprecations(GROQ.replace('| 08/16/26 ', '| soon ')),
90 ).toThrow(/shutdown date/)
91 expect(() => parseGroqDeprecations('# nothing')).toThrow()
92 })
93})
94​
95describe('mistral deprecations table', () => {
96 const rows = new Map(
97 parseMistralDeprecations(MISTRAL).map((r) => [r.rawId, r]),
98 )
99​
100 it('reads the ids issue #410 names, resolving replacement links to API names', () => {
101 expect(rows.get('pixtral-12b-2409')).toEqual({
102 rawId: 'pixtral-12b-2409',
103 deprecatedAt: day('2025-12-02'),
104 retiresAt: day('2025-12-31'),
105 replacedBy: ['ministral-14b-2512'],
106 sourceUrl: MISTRAL_DEPRECATIONS_URL,
107 })
108 expect(rows.get('mistral-small-2503')?.replacedBy).toEqual([
109 'mistral-small-2603',
110 ])
111 expect(rows.get('pixtral-large-2411')?.replacedBy).toEqual([
112 'mistral-medium-3-5',
113 ])
114 expect(rows.get('open-mistral-nemo-2407')?.retiresAt).toBe(
115 day('2026-07-31'),
116 )
117 expect(rows.get('mistral-medium-2505')?.deprecatedAt).toBe(
118 day('2026-05-22'),
119 )
120 })
121​
122 it('reads prose dates, and leaves empty cells null', () => {
123 expect(rows.get('magistral-small-2509')).toEqual(
124 expect.objectContaining({
125 deprecatedAt: day('2026-04-30'),
126 retiresAt: day('2026-07-31'),
127 }),
128 )
129 expect(rows.get('labs-leanstral-1-5')?.replacedBy).toBeNull()
130 })
131​
132 it('skips rows with no API name', () => {
133 expect([...rows.keys()].every((id) => id !== '')).toBe(true)
134 })
135​
136 it('throws on a reshaped table', () => {
137 expect(() =>
138 parseMistralDeprecations(MISTRAL.replace('| Retirement |', '| Ends |')),
139 ).toThrow(/header/)
140 expect(() =>
141 parseMistralDeprecations(MISTRAL.replace('| 2026-08-31 |', '| soon |')),
142 ).toThrow(/date/)
143 expect(() =>
144 parseMistralDeprecations(
145 // The live row stops naming the API id the replacement link needs.
146 MISTRAL.replace('| `ministral-14b-2512` |', '| |'),
147 ),
148 ).toThrow(/no API name/)
149 })
150})