Download packages/migration-legacy/test/kimi-cli-schema.test.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/migration-legacy/test/kimi-cli-schema.test.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/migration-legacy/test/kimi-cli-schema.test.ts
-
curl -L -o kimi-cli-schema.test.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/migration-legacy/test/kimi-cli-schema.test.ts
1.57 kB
| import { describe, expect, it } from 'vitest'; | |
| import { OldKimiJsonSchema, OldSessionStateSchema } from '../src/kimi-cli-schema.js'; | |
| describe('OldKimiJsonSchema', () => { | |
| it('parses a real-shape kimi.json', () => { | |
| const input = { | |
| work_dirs: [ | |
| { path: '/Users/x/proj', kaos: 'local', last_session_id: 'abc' }, | |
| { path: '/Users/x/other', kaos: 'local', last_session_id: null }, | |
| ], | |
| }; | |
| const parsed = OldKimiJsonSchema.parse(input); | |
| expect(parsed.work_dirs).toHaveLength(2); | |
| expect(parsed.work_dirs[0]!.kaos).toBe('local'); | |
| }); | |
| it('accepts missing last_session_id', () => { | |
| const input = { work_dirs: [{ path: '/x', kaos: 'local' }] }; | |
| expect(() => OldKimiJsonSchema.parse(input)).not.toThrow(); | |
| }); | |
| }); | |
| describe('OldSessionStateSchema', () => { | |
| it('parses a realistic state.json', () => { | |
| const input = { | |
| version: 1, | |
| approval: { yolo: false, afk: false, auto_approve_actions: [] }, | |
| additional_dirs: [], | |
| custom_title: 'hi', | |
| title_generated: false, | |
| title_generate_attempts: 0, | |
| plan_mode: false, | |
| plan_session_id: null, | |
| plan_slug: null, | |
| wire_mtime: 1772616338.93, | |
| archived: true, | |
| archived_at: 1774273349.5, | |
| auto_archive_exempt: false, | |
| }; | |
| const parsed = OldSessionStateSchema.parse(input); | |
| expect(parsed.custom_title).toBe('hi'); | |
| expect(parsed.archived).toBe(true); | |
| }); | |
| it('tolerates missing optional fields', () => { | |
| expect(() => OldSessionStateSchema.parse({ version: 1 })).not.toThrow(); | |
| }); | |
| }); | |