Skip to content

Commit

Permalink
SWI-4587 Add transferCallerDisplayName to Transfer Verb (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoegel authored Feb 16, 2024
1 parent f557ef7 commit 5cf1eed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions models/bxml/verbs/Transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type NumberEntities = Array<PhoneNumber | SipUri>;

interface TransferAttributes {
transferCallerId?: string;
transferCallerDisplayName?: string;
callTimeout?: number;
transferCompleteUrl?: string;
transferCompleteMethod?: string;
Expand Down
1 change: 1 addition & 0 deletions tests/integration/bxml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ describe('BXML Integration Tests', () => {

const transferAttributes = {
transferCallerId: '+19195551234',
transferCallerDisplayName: 'initialDisplayName',
callTimeout: 5,
transferCompleteUrl: 'https://initial.com',
transferCompleteMethod: 'POST',
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/bxml/verbs/Transfer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { Transfer } = require('../../../../models/bxml/verbs/Transfer');
describe('Transfer', () => {
const attributes = {
transferCallerId: '+19195551234',
transferCallerDisplayName: 'initialDisplayName',
callTimeout: 5,
transferCompleteUrl: 'https://initial.com',
transferCompleteMethod: 'POST',
Expand All @@ -25,7 +26,7 @@ describe('Transfer', () => {

test('should create a Transfer Verb', () => {
const transfer = new Transfer(attributes);
const expected = '<Transfer transferCallerId="+19195551234" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"/>';
const expected = '<Transfer transferCallerId="+19195551234" transferCallerDisplayName="initialDisplayName" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"/>';

expect(transfer).toBeInstanceOf(Transfer);
expect(transfer).toBeInstanceOf(Verb);
Expand All @@ -34,9 +35,9 @@ describe('Transfer', () => {

test('should create a Transfer Verb with nested PhoneNumber and SipUri', () => {
let transfer = new Transfer(attributes, phoneNumber);
const expected = '<Transfer transferCallerId="+19195551234" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber></Transfer>';
const expectedSingle = '<Transfer transferCallerId="+19195551234" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber><SipUri>sip:[email protected]</SipUri></Transfer>';
const expectedMultiple = '<Transfer transferCallerId="+19195551234" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber><SipUri>sip:[email protected]</SipUri><SipUri>sip:[email protected]</SipUri><PhoneNumber>+19195551234</PhoneNumber></Transfer>';
const expected = '<Transfer transferCallerId="+19195551234" transferCallerDisplayName="initialDisplayName" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber></Transfer>';
const expectedSingle = '<Transfer transferCallerId="+19195551234" transferCallerDisplayName="initialDisplayName" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber><SipUri>sip:[email protected]</SipUri></Transfer>';
const expectedMultiple = '<Transfer transferCallerId="+19195551234" transferCallerDisplayName="initialDisplayName" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber><SipUri>sip:[email protected]</SipUri><SipUri>sip:[email protected]</SipUri><PhoneNumber>+19195551234</PhoneNumber></Transfer>';

expect(transfer).toBeInstanceOf(Transfer);
expect(transfer).toBeInstanceOf(Verb);
Expand All @@ -51,7 +52,7 @@ describe('Transfer', () => {

test('should test the addTransferRecipients method method when no verbs are initially nested', () => {
const transfer = new Transfer(attributes);
const expected = '<Transfer transferCallerId="+19195551234" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber></Transfer>';
const expected = '<Transfer transferCallerId="+19195551234" transferCallerDisplayName="initialDisplayName" callTimeout="5" transferCompleteUrl="https://initial.com" transferCompleteMethod="POST" transferCompleteFallbackUrl="https://initial.com" transferCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag" diversionTreatment="propagate" diversionReason="user-busy"><PhoneNumber>+19195551234</PhoneNumber></Transfer>';

transfer.addTransferRecipients(phoneNumber);
expect(transfer.toBxml()).toBe(expected);
Expand Down

0 comments on commit 5cf1eed

Please sign in to comment.