update on the agents and registry side
This commit is contained in:
42
tests/lib/skills/DoorstepStallSkill.test.js
Normal file
42
tests/lib/skills/DoorstepStallSkill.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { DoorstepStallSkill } from '@/lib/assistant/skills/definitions/DoorstepStallSkill';
|
||||
|
||||
describe('DoorstepStallSkill', () => {
|
||||
const fixedNow = '2026-08-31 12:00:00';
|
||||
|
||||
it('detects riders stalled at door past threshold', () => {
|
||||
const rows = [
|
||||
{
|
||||
bookingid: 1,
|
||||
bookingno: 'BK-1',
|
||||
orderstatus: 'arrived',
|
||||
reachedat: '2026-08-31 11:35:00', // 25 min waiting
|
||||
ridername: 'Karthik Raja',
|
||||
userid: 44,
|
||||
},
|
||||
{
|
||||
bookingid: 2,
|
||||
bookingno: 'BK-2',
|
||||
orderstatus: 'arrived',
|
||||
reachedat: '2026-08-31 11:55:00', // 5 min waiting
|
||||
ridername: 'Praveen',
|
||||
userid: 45,
|
||||
},
|
||||
];
|
||||
|
||||
const findings = DoorstepStallSkill.evaluate(rows, fixedNow, { arrivedStalledMin: 20 });
|
||||
expect(findings.length).toBe(1);
|
||||
expect(findings[0].id).toBe('stalled_at_door');
|
||||
expect(findings[0].count).toBe(1);
|
||||
expect(findings[0].rows[0].bookingid).toBe(1);
|
||||
});
|
||||
|
||||
it('executes ping_stalled_rider tool handler', async () => {
|
||||
const tool = DoorstepStallSkill.tools.find((t) => t.name === 'ping_stalled_rider');
|
||||
expect(tool).toBeDefined();
|
||||
|
||||
const result = await tool.handler({ milerId: 44 });
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.proposal.action).toBe('notify_miler');
|
||||
expect(result.proposal.milerId).toBe(44);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user