48 lines
2.3 KiB
TypeScript
48 lines
2.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
|
||
import { resolveInventoryAddressIntent } from "../src/services/addressInventoryIntentSignals";
|
||
import { resolveAddressIntent } from "../src/services/addressIntentResolver";
|
||
|
||
describe("addressInventoryIntentSignals", () => {
|
||
it("classifies plain Russian stock wording from the agent replay as inventory on hand", () => {
|
||
const result = resolveAddressIntent("какие остатки на складе на март 2021");
|
||
|
||
expect(result.intent).toBe("inventory_on_hand_as_of_date");
|
||
expect(result.reasons).toContain("inventory_on_hand_signal_detected");
|
||
});
|
||
|
||
it("classifies warehouse snapshot wording through the extracted inventory owner", () => {
|
||
const result = resolveInventoryAddressIntent("show inventory on hand as of 2020-03-15");
|
||
|
||
expect(result?.intent).toBe("inventory_on_hand_as_of_date");
|
||
expect(result?.reasons).toContain("inventory_on_hand_signal_detected");
|
||
});
|
||
|
||
it("classifies selected-object purchase provenance wording through the extracted inventory owner", () => {
|
||
const result = resolveInventoryAddressIntent("selected object supplier provenance");
|
||
|
||
expect(result?.intent).toBe("inventory_purchase_provenance_for_item");
|
||
expect(result?.reasons).toContain("inventory_selected_object_provenance_signal_detected");
|
||
});
|
||
|
||
it("keeps the main resolver behavior stable through inventory-owner delegation", () => {
|
||
const result = resolveAddressIntent("а по этой позиции когда была закупка?");
|
||
|
||
expect(result.intent).toBe("inventory_purchase_provenance_for_item");
|
||
expect(result.reasons).toContain("inventory_purchase_date_signal_detected");
|
||
});
|
||
|
||
it("classifies direct Russian purchase-date wording with an explicit item", () => {
|
||
const result = resolveAddressIntent("Когда был куплен товар Столешница 600*3050*26 дуб ниагара");
|
||
|
||
expect(result.intent).toBe("inventory_purchase_provenance_for_item");
|
||
expect(result.reasons).toContain("inventory_purchase_date_signal_detected");
|
||
});
|
||
|
||
it("does not steal non-inventory open-items wording into the inventory owner", () => {
|
||
const result = resolveInventoryAddressIntent("хвосты покажи по счету 60 на август 2022");
|
||
|
||
expect(result).toBeNull();
|
||
});
|
||
});
|