NODEDC_1C/llm_normalizer/backend/tests/evalRuntimeQuestionSplit.te...

37 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from "vitest";
import { __evalRouteTestUtils } from "../src/routes/eval";
describe("eval runtime question splitting", () => {
it("merges short conversational tails into previous question", () => {
const parsed = __evalRouteTestUtils.splitQuestionCandidate(
"Покажи контрагентов с риском несверки по акту? и коротко? без воды?"
);
expect(parsed).toHaveLength(1);
expect(parsed[0]).toMatch(/коротко/i);
expect(parsed[0]).toMatch(/без воды/i);
});
it("keeps independent full questions as separate items", () => {
const parsed = __evalRouteTestUtils.splitQuestionCandidate(
"Где зависли оплаты по счету 60? Какие документы не закрылись по 62 за июль 2020?"
);
expect(parsed).toHaveLength(2);
expect(parsed[0]).toMatch(/\?/);
expect(parsed[1]).toMatch(/\?/);
});
it("normalizes list input and removes placeholders and duplicates", () => {
const parsed = __evalRouteTestUtils.normalizeRuntimeQuestions([
"Вопросы",
"Покажи хвосты по поставщикам",
"и коротко?"
]);
expect(parsed).toHaveLength(1);
expect(parsed[0]).toMatch(/поставщик/i);
expect(parsed[0]).toMatch(/коротко/i);
});
});