@redningsselskapet/pswincom-sms-gateway
Advanced tools
Comparing version 1.0.1 to 1.0.2
const SMSGateway = require('../../sms-gateway') | ||
const { NO_REF_ERROR, LOGON_ERROR } = require('../../error-types') | ||
@@ -22,7 +23,3 @@ const gw = SMSGateway({ user: 'user', password: 'pass', sender: 'testapp' }) | ||
.sendSms({ receiver: '4791679501', message: 'KOKO' }).catch(err => { | ||
expect(err).toEqual(Error({ | ||
receiver: '4791679501', | ||
status: 'failure', | ||
error: 'logon failure' | ||
})) | ||
expect(err).toEqual(Error(LOGON_ERROR)) | ||
}) | ||
@@ -29,0 +26,0 @@ }) |
const smsGateway = require('pswincom-gateway') | ||
const { NO_REF_ERROR, LOGON_ERROR } = require('../error-types') | ||
@@ -18,19 +19,5 @@ module.exports = ({ user, password, sender }) => { | ||
done: (result) => { | ||
if (result.logon !== 'OK') | ||
reject( | ||
new Error({ | ||
receiver: '4791679501', | ||
status: 'failure', | ||
error: 'logon failure' | ||
}) | ||
) | ||
if (result.logon !== 'OK') reject(new Error(LOGON_ERROR)) | ||
if (!result.refs) { | ||
reject( | ||
new Error({ | ||
receiver: receiver, | ||
status: 'success', | ||
error: | ||
'No ref. This probaly means that message did not reach its destination. Check that the number is correct.' | ||
}) | ||
) | ||
reject(new Error(NO_REF_ERROR)) | ||
} | ||
@@ -37,0 +24,0 @@ resolve({ |
{ | ||
"name": "@redningsselskapet/pswincom-sms-gateway", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "SMS Gateway", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
10
4251
104