update on the agents and registry side
This commit is contained in:
37
tests/lib/skills/HighValueCodSkill.test.js
Normal file
37
tests/lib/skills/HighValueCodSkill.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import { HighValueCodSkill } from '@/lib/assistant/skills/definitions/HighValueCodSkill';
|
||||
|
||||
describe('HighValueCodSkill', () => {
|
||||
it('detects high value COD consignments at or above threshold', () => {
|
||||
const rows = [
|
||||
{
|
||||
bookingid: 1,
|
||||
bookingno: 'BK-COD-1',
|
||||
orderstatus: 'active',
|
||||
paymenttype: 'COD',
|
||||
orderamount: 4500,
|
||||
},
|
||||
{
|
||||
bookingid: 2,
|
||||
bookingno: 'BK-COD-2',
|
||||
orderstatus: 'active',
|
||||
paymenttype: 'COD',
|
||||
orderamount: 1500,
|
||||
},
|
||||
];
|
||||
|
||||
const findings = HighValueCodSkill.evaluate(rows, '2026-08-31 12:00:00', { codRiskThresholdAmount: 3000 });
|
||||
expect(findings.length).toBe(1);
|
||||
expect(findings[0].id).toBe('high_value_cod_alert');
|
||||
expect(findings[0].count).toBe(1);
|
||||
expect(findings[0].rows[0].bookingid).toBe(1);
|
||||
});
|
||||
|
||||
it('executes enforce_otp_verification tool handler', async () => {
|
||||
const tool = HighValueCodSkill.tools.find((t) => t.name === 'enforce_otp_verification');
|
||||
expect(tool).toBeDefined();
|
||||
|
||||
const result = await tool.handler({ bookingId: 1 });
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.proposal.action).toBe('require_otp');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user