UNPKG

@humanlayer/sdk

Version:

typescript client for humanlayer.dev

49 lines (48 loc) 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); test('Escalation type - basic functionality', () => { // Test escalation without channel const escalation = { escalation_msg: 'Test escalation', }; expect(escalation.channel).toBeUndefined(); expect(escalation.escalation_msg).toBe('Test escalation'); expect(escalation.additional_recipients).toBeUndefined(); }); test('Escalation type - with channel', () => { var _a, _b, _c; // Test escalation with channel const emailChannel = { address: 'test@example.com', }; const contactChannel = { email: emailChannel, }; const escalationWithChannel = { escalation_msg: 'Escalation with channel', channel: contactChannel, }; expect(escalationWithChannel.channel).toBeDefined(); expect((_a = escalationWithChannel.channel) === null || _a === void 0 ? void 0 : _a.email).toBeDefined(); expect((_c = (_b = escalationWithChannel.channel) === null || _b === void 0 ? void 0 : _b.email) === null || _c === void 0 ? void 0 : _c.address).toBe('test@example.com'); expect(escalationWithChannel.escalation_msg).toBe('Escalation with channel'); }); test('Escalation type - serialization includes channel', () => { // Test escalation serializes channel field correctly const emailChannel = { address: 'ceo@company.com', experimental_subject_line: 'CRITICAL: Immediate approval required', }; const contactChannel = { email: emailChannel, }; const escalation = { escalation_msg: 'CRITICAL: Still no response', channel: contactChannel, }; // Test JSON serialization includes channel field const serialized = JSON.parse(JSON.stringify(escalation)); expect(serialized.channel).toBeDefined(); expect(serialized.channel.email.address).toBe('ceo@company.com'); expect(serialized.channel.email.experimental_subject_line).toBe('CRITICAL: Immediate approval required'); });