finesse-toolkit
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -17,4 +17,4 @@ 'use strict'; | ||
value = JSON.stringify(value); | ||
this._client.setex(key, MONTH_IN_SECONDS, value) | ||
.catch(Util._promiseErrorHandler); | ||
return this._client.setex(key, MONTH_IN_SECONDS, value) | ||
.catch(Util._promiseErrorHandler); | ||
} | ||
@@ -21,0 +21,0 @@ |
{ | ||
"name": "finesse-toolkit", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "useful tools for finesse phone system", | ||
"main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^3.3.4", | ||
"google-libphonenumber": "^1.0.17", | ||
"hiredis": "^0.4.1", | ||
"ioredis": "^1.15.1", | ||
"bluebird": "^3.4.1", | ||
"google-libphonenumber": "^1.0.22", | ||
"hiredis": "^0.5.0", | ||
"ioredis": "^2.0.1", | ||
"libxmljs": "^0.18.0", | ||
"lodash": "^4.9.0", | ||
"node-fetch": "^1.5.0", | ||
"node-xmpp-client": "^3.0.0" | ||
"lodash": "^4.13.1", | ||
"node-fetch": "^1.5.3", | ||
"node-xmpp-client": "^3.0.1" | ||
}, | ||
@@ -26,5 +26,5 @@ "scripts": { | ||
"devDependencies": { | ||
"mocha": "^2.4.5", | ||
"sinon": "^1.17.3" | ||
"mocha": "^2.5.3", | ||
"sinon": "^1.17.4" | ||
} | ||
} |
@@ -1,13 +0,11 @@ | ||
var assert = require('assert'); | ||
var sinon = require('sinon'); | ||
const assert = require('assert'); | ||
var XmlHelper = require('../xml'); | ||
var sampleDialogPubsub = require('./data/sample_dialog_xmpp_updates'); | ||
var sampleInfoCall = require('./data/sample_info'); | ||
var sampleReasons = require('./data/sample_reasons'); | ||
var RedisStore = require('../lib/redis_store'); | ||
const XmlHelper = require('../xml'); | ||
const sampleDialogPubsub = require('./data/sample_dialog_xmpp_updates'); | ||
const sampleInfoCall = require('./data/sample_info'); | ||
const sampleReasons = require('./data/sample_reasons'); | ||
describe('XmlHelper', () => { | ||
var dialogHelper = new XmlHelper(sampleDialogPubsub.incomingCall); | ||
var userHelper = new XmlHelper(sampleInfoCall.notReady); | ||
const dialogHelper = new XmlHelper(sampleDialogPubsub.incomingCall); | ||
const userHelper = new XmlHelper(sampleInfoCall.notReady); | ||
@@ -42,3 +40,3 @@ describe('#constructor', () => { | ||
it('should return data for a user', () => { | ||
var expected = { | ||
const expected = { | ||
user: true, | ||
@@ -64,11 +62,11 @@ reason: { | ||
before((done) => { | ||
sinon | ||
.stub(RedisStore, 'constructor') | ||
.yields(true); | ||
sinon | ||
.stub(RedisStore, 'exists') | ||
.returns(Promise.resolve(true)); | ||
sinon | ||
.stub(RedisStore, 'get') | ||
.returns(Promise.resolve({ name: 'John Smith', screenPop: null, phoneNumber: '12345' })); | ||
// sinon | ||
// .stub(RedisStore, 'constructor') | ||
// .yields(true); | ||
// sinon | ||
// .stub(RedisStore, 'exists') | ||
// .returns(Promise.resolve(true)); | ||
// sinon | ||
// .stub(RedisStore, 'get') | ||
// .returns(Promise.resolve({ name: 'John Smith', screenPop: null, phoneNumber: '12345' })); | ||
done(); | ||
@@ -78,5 +76,5 @@ }); | ||
after((done) => { | ||
RedisStore.constructor.restore(); | ||
RedisStore.exists.restore(); | ||
RedisStore.get.restore(); | ||
// RedisStore.constructor.restore(); | ||
// RedisStore.exists.restore(); | ||
// RedisStore.get.restore(); | ||
@@ -86,10 +84,11 @@ done(); | ||
it('should not return data for a user', () => { | ||
return userHelper.promisedDialogJson('').then((data) => { | ||
it('should not return data for a user', (done) => { | ||
userHelper.promisedDialogJson('').then((data) => { | ||
assert.deepEqual(data, { dialog: false }); | ||
done(); | ||
}); | ||
}); | ||
it('should return data for a dialog', () => { | ||
var expected = { | ||
it('should return data for a dialog', (done) => { | ||
const expected = { | ||
dialog: true, | ||
@@ -112,4 +111,5 @@ dialogs: { | ||
return dialogHelper.promisedDialogJson('34671').then((data) => { | ||
dialogHelper.promisedDialogJson('34671').then((data) => { | ||
assert.deepEqual(data, expected); | ||
done(); | ||
}); | ||
@@ -125,3 +125,3 @@ }); | ||
it('should return data for a dialog', () => { | ||
var expected = { | ||
const expected = { | ||
dialog: true, | ||
@@ -149,14 +149,22 @@ dialogs: { | ||
describe('#reasonsJson', () => { | ||
it('should return nothing for a user', () => { | ||
assert.deepEqual(userHelper.reasonsJson(), {}); | ||
it('should return nothing for a user', (done) => { | ||
userHelper.reasonsJson().then(data => { | ||
assert.deepEqual(data, {}); | ||
done(); | ||
}); | ||
}); | ||
it('should return nothing for a dialog', () => { | ||
assert.deepEqual(dialogHelper.reasonsJson(), {}); | ||
it('should return nothing for a dialog', (done) => { | ||
dialogHelper.reasonsJson().then(data => { | ||
assert.deepEqual(data, {}); | ||
done(); | ||
}); | ||
}); | ||
it('should return valid data for a reason', () => { | ||
var reasons = new XmlHelper(sampleReasons).reasonsJson(); | ||
assert.equal(reasons.length, 9); | ||
assert.deepEqual(reasons[0], { category: 'NOT_READY', code: '1', label: 'Break' }); | ||
it('should return valid data for a reason', (done) => { | ||
new XmlHelper(sampleReasons).reasonsJson().then(data => { | ||
assert.equal(data.length, 9); | ||
assert.deepEqual(data[0], { category: 'NOT_READY', code: '1', label: 'Break' }); | ||
done(); | ||
}); | ||
}); | ||
@@ -167,3 +175,3 @@ }); | ||
it('should return the correct xml', () => { | ||
var obj = { | ||
const obj = { | ||
root: 'User', | ||
@@ -176,3 +184,3 @@ properties: { | ||
var xml = XmlHelper.objToXml(obj); | ||
const xml = XmlHelper.objToXml(obj); | ||
@@ -179,0 +187,0 @@ assert.equal(xml, '<User><extension>1234</extension><state>LOGIN</state></User>'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50724
1364
+ Addedcluster-key-slot@1.1.2(transitive)
+ Addedhiredis@0.5.0(transitive)
+ Addedioredis@2.5.0(transitive)
+ Addedredis-commands@1.7.0(transitive)
+ Addedredis-parser@1.3.0(transitive)
- Removedbluebird@2.11.0(transitive)
- Removedhiredis@0.4.1(transitive)
- Removedioredis@1.15.1(transitive)
- Removedlodash@3.10.1(transitive)
Updatedbluebird@^3.4.1
Updatedhiredis@^0.5.0
Updatedioredis@^2.0.1
Updatedlodash@^4.13.1
Updatednode-fetch@^1.5.3
Updatednode-xmpp-client@^3.0.1