import { describe, expect, it } from "vitest"; import { __autoRunsQuestionTestUtils } from "../src/routes/autoRuns"; describe("autoruns question extraction", () => { it("merges conversational tails instead of producing micro-prompts", () => { const parsed = __autoRunsQuestionTestUtils.splitQuestionCandidates( "Покажи рисковые хвосты по расчетам с поставщиками? и коротко? без воды?" ); expect(parsed).toHaveLength(1); expect(parsed[0]).toMatch(/коротко/i); expect(parsed[0]).toMatch(/без воды/i); }); it("keeps independent questions separated", () => { const parsed = __autoRunsQuestionTestUtils.splitQuestionCandidates( "Где зависли оплаты по счету 60? Какие акты сверки с риском расхождения по 62?" ); expect(parsed).toHaveLength(2); }); it("extracts questions from JSON payload and skips placeholders", () => { const parsed = __autoRunsQuestionTestUtils.extractQuestionsFromAutogenOutput( JSON.stringify({ questions: ["Вопросы", "Покажи хвосты по поставщикам", "и коротко?"] }) ); expect(parsed).toHaveLength(1); expect(parsed[0]).toMatch(/поставщик/i); expect(parsed[0]).toMatch(/коротко/i); }); });