071faa482c
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
31 lines
757 B
TypeScript
31 lines
757 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { parseJsonResponseText, parseLineListContent } from './llmParsers';
|
|
|
|
describe('llmParsers', () => {
|
|
it('parses fenced json payloads', () => {
|
|
expect(
|
|
parseJsonResponseText('```json\n{"storyText":"hello","options":[]}\n```'),
|
|
).toEqual({
|
|
storyText: 'hello',
|
|
options: [],
|
|
});
|
|
});
|
|
|
|
it('parses embedded json objects', () => {
|
|
expect(
|
|
parseJsonResponseText('prefix {"storyText":"hello","options":[]} suffix'),
|
|
).toEqual({
|
|
storyText: 'hello',
|
|
options: [],
|
|
});
|
|
});
|
|
|
|
it('extracts compact suggestion lines', () => {
|
|
expect(parseLineListContent('- first\n2. second\nthird', 2)).toEqual([
|
|
'first',
|
|
'second',
|
|
]);
|
|
});
|
|
});
|