-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding resource and test cases * Adding resource and test cases * Delete MessaingHostedNumberOrders.js Co-authored-by: Quagser <[email protected]> Co-authored-by: d-telnyx <[email protected]>
- Loading branch information
1 parent
fddd459
commit abbc186
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../TelnyxResource').extend({ | ||
path: 'messaging_hosted_number_orders', | ||
includeBasic: ['list', 'retrieve', 'create'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../TelnyxResource').extend({ | ||
path: 'messaging_hosted_number_orders', | ||
includeBasic: ['del'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
var utils = require('../../testUtils'); | ||
var telnyx = utils.getTelnyxMock(); | ||
var expect = require('chai').expect; | ||
var TEST_AUTH_KEY = utils.getUserTelnyxKey(); | ||
|
||
|
||
describe('retrieve', function() { | ||
function responseFn(response) { | ||
expect(response.data).to.include({id: '123'}); | ||
} | ||
it('Sends the correct request', function() { | ||
return telnyx.messagingHostedNumberOrders.retrieve('123').then((response) => { | ||
responseFn(response) | ||
}); | ||
}) | ||
it('Sends the correct request [with specified auth]', function() { | ||
return telnyx.messagingHostedNumberOrders.retrieve('123', TEST_AUTH_KEY) | ||
.then(responseFn); | ||
}); | ||
}); | ||
describe('create', function() { | ||
function responseFn(response) { | ||
expect(response.data).to.include({ | ||
record_type: 'messaging_hosted_number_order', | ||
}); | ||
expect(response.data).to.have.property('status'); | ||
expect(response.data).to.have.property('id'); | ||
} | ||
function responseFnNoBody(response) { | ||
expect(response.data).to.have.property('id'); | ||
expect(response.data).to.have.property('requirements_met'); | ||
expect(response.data).to.include({record_type: 'messaging_hosted_number_order'}); | ||
} | ||
it('Sends the correct request', function() { | ||
return telnyx.messagingHostedNumberOrders.create({messaging_profile_id: '442191469269222625'}) | ||
.then(responseFn); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
return telnyx.messagingHostedNumberOrders.create({messaging_profile_id: '442191469269222625'}, TEST_AUTH_KEY) | ||
.then(responseFn); | ||
}); | ||
it('Sends the correct request [with specified auth and no body]', function() { | ||
telnyx.messagingHostedNumberOrders.create(TEST_AUTH_KEY) | ||
.then(responseFnNoBody); | ||
}); | ||
}); | ||
describe('list', function() { | ||
function responseFn(response) { | ||
expect(response.data[0]).to.have.property('id'); | ||
expect(response.data[0]).to.include({record_type: 'messaging_hosted_number_order'}); | ||
} | ||
it('Sends the correct request', function() { | ||
return telnyx.messagingHostedNumberOrders.list() | ||
.then(responseFn); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
return telnyx.messagingHostedNumberOrders.list(TEST_AUTH_KEY) | ||
.then(responseFn); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var utils = require('../../testUtils'); | ||
var telnyx = utils.getTelnyxMock(); | ||
var expect = require('chai').expect; | ||
|
||
describe('del', function() { | ||
|
||
function responseFn(response) { | ||
if (response.data) { | ||
expect(response.data).to.have.property('id'); | ||
expect(response.data).to.include({record_type: 'messaging_hosted_numbers'}); | ||
} | ||
} | ||
it('Sends the correct request [with specified auth]', function() { | ||
return telnyx.messagingHostedNumbers.del('123') | ||
.then(responseFn); | ||
}); | ||
}); | ||
|