NODEDC_1C/llm_normalizer/backend/tests/addressIntentResolverRegres...

49 lines
2.2 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 { resolveAddressIntent } from "../src/services/addressIntentResolver";
describe("addressIntentResolver regression bridges", () => {
it("detects colloquial VAT liability for a month period", () => {
const result = resolveAddressIntent("прикинь какой ндс нам надо заплатить на февраль 2017");
expect(result.intent).toBe("vat_liability_confirmed_for_tax_period");
});
it("detects payables snapshot wording in plain human form", () => {
const result = resolveAddressIntent("мы должны комуто денег на сегодня?");
expect(result.intent).toBe("payables_confirmed_as_of_date");
});
it("detects receivables snapshot wording through light current-turn typo noise", () => {
const result = resolveAddressIntent(
"\u043a\u0442\u043e \u043d\u0430\u043c\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0435\u043d\u0435\u0433 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f"
);
expect(result.intent).toBe("receivables_confirmed_as_of_date");
expect(result.reasons).toContain("current_turn_noise_normalized");
});
it("detects top customer all-time revenue wording", () => {
const result = resolveAddressIntent("кто у нас самый доходный клиент за все время");
expect(result.intent).toBe("customer_revenue_and_payments");
});
it("detects top-year company revenue wording", () => {
const result = resolveAddressIntent("какой у нас самый доходный год");
expect(result.intent).toBe("customer_revenue_and_payments");
});
it("does not collapse very old stock request into generic inventory snapshot", () => {
const result = resolveAddressIntent("Есть ли остатки товара, которые закупались очень давно");
expect(result.intent).toBe("inventory_aging_by_purchase_date");
});
it("detects bare historical inventory root with explicit month-year", () => {
const result = resolveAddressIntent("остатки на март 2016");
expect(result.intent).toBe("inventory_on_hand_as_of_date");
});
});