feat: separate prior records behind an owner switch and count last-period questions
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { classifyCountQuestion } from '../src/ai/ask-count';
|
||||
|
||||
describe('سؤالهای شمارشی دستیار', () => {
|
||||
it('لید جدید هفته گذشته را ساختن حساب نمیکند', () => {
|
||||
const intent = classifyCountQuestion('تعداد لید جدید در هفته گذشته؟');
|
||||
assert.ok(intent);
|
||||
assert.equal(intent.entity, 'lead');
|
||||
assert.equal(intent.period, 'last_week');
|
||||
assert.equal(intent.leadBucket, 'summary');
|
||||
assert.equal(intent.hint, '');
|
||||
});
|
||||
|
||||
it('هفتهی گذشته و ماه قبل را هم میفهمد', () => {
|
||||
assert.equal(classifyCountQuestion('چند مشتری جدید هفتهی گذشته داشتیم؟')?.period, 'last_week');
|
||||
assert.equal(classifyCountQuestion('تعداد معاملات ماه قبل')?.period, 'last_month');
|
||||
assert.equal(classifyCountQuestion('تعداد فعالیت جدید این هفته')?.period, 'week');
|
||||
});
|
||||
|
||||
it('مرحلهٔ جدید را با بازه قاطی نمیکند', () => {
|
||||
const intent = classifyCountQuestion('چند لید در مرحله جدید هفته گذشته داریم؟');
|
||||
assert.ok(intent);
|
||||
assert.equal(intent.period, 'last_week');
|
||||
assert.equal(intent.hint, 'جدید');
|
||||
});
|
||||
|
||||
it('بدون بازه، لید جدید یعنی مرحلهٔ جدید', () => {
|
||||
const intent = classifyCountQuestion('تعداد لید جدید');
|
||||
assert.ok(intent);
|
||||
assert.equal(intent.period, undefined);
|
||||
assert.equal(intent.hint, 'جدید');
|
||||
});
|
||||
|
||||
it('دستور ساخت را سؤال شمارشی نمیگیرد', () => {
|
||||
assert.equal(classifyCountQuestion('یک لید جدید به نام علی بساز'), null);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user