plivo-node/test/test.phlo.js
nixonsam a4e3f9fd47
Add PHLO support (#112)
* Added phlo client.

* Finished implementaiton of initializing phlo client.

* Finished logic for v2 methods of multiparty call(not members).

* Added test cases for multiparty call.

* Finished logic for phlo get api.

* Added member method structure.

* Finished implementation of phlo.run().

* Finished api calls for multi party(except abort transfer).

* Deleted old rest.js file.

* Finished abortTranfer implementation with test cases.

* Finished implementation of member.resumeCall().

* Finished all member functions.

* Reverted debugging logic.

* Removed console.log

* Added samples for all apis. method structure change for abort transfer.

* Resolved nsp issue.

* Audit fix.

* Package Lock Fix.

* Added test proxy for test cases.

* Resolved issue in request.js json format.

* Improved comments.

* Added test cases for .get() methods.

* Removed async await to support older browsers.

* Modified examples of phlo, removed async await.

* Resolved example issues, remove auth credentials.

* Removed es6 declaration syntaxes from phlo example.

* Added logic to pass payload.

* changed beta version 4.1-beta.1

* changed beta version 4.1-beta.1

* changed beta version 4.1-beta.1

* changes in changelog & readme- Add PHLO support
2019-03-11 15:43:57 +05:30

130 lines
4.2 KiB
JavaScript

'use strict';
import {
PhloClient
} from '../lib/rest/client-test';
// } from '../lib/rest/client';
import { doesNotReject } from 'assert';
let authId = 'auth-id';
let authToken = 'auth-token';
let phloId = 'sample-phlo-id';
let mpcId = 'sample-mpc-id';
describe('PhloInterface', function () {
it('Should initialize phlo via phloClient.phlo.get(phloId)', function () {
let phloClient = new PhloClient(authId, authToken);
phloClient.phlo.get(phloId).then(function (phloResult) {
// console.log('phlo result is ', phloResult);
});
});
it('Run phlo via phloClient.phlo(phloId).run()', function () {
let phloClient = new PhloClient(authId, authToken);
phloClient.phlo(phloId).run().then(function (phlo) {
// console.log('phlo run result', phlo);
});
});
it('Run phlo via phloClient.phlo.get(phloId).run()', function () {
let phloClient = new PhloClient(authId, authToken);
phloClient.phlo.get(phloId).then(function (phlo) {
// console.log('phlo result', phlo);
phlo.run().then(function (phlo) {
// console.log('phlo run result', phlo);
});
});
});
});
/******************** Multiparty call test cases *********************/
describe('PhloMultiPartyCallInterface', function () {
it('Get multiparty call details', function () {
let phloClient = new PhloClient(authId, authToken);
phloClient.phlo(phloId).multiPartyCall.get(mpcId).then(function (result) {
// console.log('get multiparty call result', result);
});
});
it('Add member to multi party call', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).call('919920700964', '919898967510').then(function (result) {
// console.log('Add member to call', result);
});
});
it('Add member to multi party call - using multiPartyCall.get()', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall.get(mpcId).then(function (result) {
result.call('919920700964', '919898967510').then(function (callResult) {
// console.log('call result', callResult);
});
})
});
it('Warm Transfer - multi party call', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).warmTransfer('919920700964', '919898967510').then(function (callResult) {
// console.log('Warm Transfer result', callResult);
});
});
it('Warm Transfer - multi party call - using multiPartyCall.get()', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall.get(mpcId).then(function (result) {
result.warmTransfer('919920700964', '919898967510').then(function (callResult) {
// console.log('Warm Transfer result', callResult);
});
});
});
it('Cold Transfer - multi party call', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).coldTransfer('919920700964', '919898967510').then(function (callResult) {
// console.log('Warm Transfer result', callResult);
});
});
it('Cold Transfer - multi party call- using multiPartyCall.get()', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).coldTransfer('919920700964', '919898967510').then(function (callResult) {
// console.log('cold Transfer result', callResult);
});
});
it('Abort Transfer - multi party call ', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).abortTransfer('919920700964').then(function (callResult) {
// console.log('cold Transfer result', callResult);
});
});
it('Abort Transfer - multi party call- using multiPartyCall.get()', function () {
let phloClient = new PhloClient(authId, authToken);
let phlo = phloClient.phlo(phloId);
phlo.multiPartyCall(mpcId).abortTransfer('919920700964').then(function (abortTransferResult) {
console.log('cold Transfer result', abortTransferResult);
});
});
});