| 1 | import { describe, expect, it } from 'vitest' |
| 2 | import { toYamlTextResult } from './mcp-response.util' |
| 3 | |
| 4 | describe('mcp-response.util', () => { |
| 5 | it('序列化 yaml 时会过滤 undefined 并格式化日期', () => { |
| 6 | const result = toYamlTextResult({ |
| 7 | foo: 'bar', |
| 8 | optional: undefined, |
| 9 | nested: { |
| 10 | createdAt: new Date('2026-04-01T00:00:00.000Z'), |
| 11 | }, |
| 12 | }) |
| 13 | |
| 14 | expect(result).toEqual({ |
| 15 | content: [{ |
| 16 | type: 'text', |
| 17 | text: 'foo: bar\nnested:\n createdAt: 2026-04-01T00:00:00.000Z\n', |
| 18 | }], |
| 19 | }) |
| 20 | }) |
| 21 | }) |
| 22 |