From 93379a328d88741adaf4a4fcd326a54701697514 Mon Sep 17 00:00:00 2001 From: lilleman Date: Fri, 1 May 2015 12:44:41 +0200 Subject: [PATCH] Modified tests to match new file structure --- test/01_encodings.js | 2 +- test/02_types.js | 2 +- test/03_pdu.js | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/01_encodings.js b/test/01_encodings.js index 3c51c62..23ab6e5 100644 --- a/test/01_encodings.js +++ b/test/01_encodings.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'), - encodings = require('../defs').encodings; + encodings = require('../lib/defs').encodings; describe('encodings', function() { describe('ASCII', function() { diff --git a/test/02_types.js b/test/02_types.js index 44f13f7..c8eaecf 100644 --- a/test/02_types.js +++ b/test/02_types.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'), - types = require('../defs').types; + types = require('../lib/defs').types; describe('int8', function() { var b = new Buffer([0, 0x65]), expected = 0x65; diff --git a/test/03_pdu.js b/test/03_pdu.js index 89dca88..a220739 100644 --- a/test/03_pdu.js +++ b/test/03_pdu.js @@ -7,7 +7,7 @@ describe('PDU convertion', function() { describe('No TLVs', function() { it('should build a PDU buffer for bind_transceiver_resp with error correctly', function(done) { - larvitsmpp.objToPdu({ + larvitsmpp.utils.objToPdu({ 'cmdName': 'bind_transceiver_resp', 'cmdStatus': 'ESME_RALYBND', 'seqNr': 1 @@ -24,14 +24,14 @@ describe('PDU convertion', function() { }); it('should be able to do the above test and put it back to an object', function(done) { - larvitsmpp.objToPdu({ + larvitsmpp.utils.objToPdu({ 'cmdName': 'bind_transceiver_resp', 'cmdStatus': 'ESME_RALYBND', 'seqNr': 1 }, function(err, pdu) { assert( ! err, 'Error should be negative'); - larvitsmpp.pduToObj(pdu, function(err, obj) { + larvitsmpp.utils.pduToObj(pdu, function(err, obj) { assert( ! err, 'Error should be negative'); assert(obj.cmdId.toString(16) === '80000009', 'Command ID should be 0x80000009'); @@ -46,7 +46,7 @@ describe('PDU convertion', function() { it('should parse a PDU to obj correctly', function(done) { var pdu = new Buffer('0000002F000000020000000000000001534D50503354455354007365637265743038005355424D4954310000010100', 'hex'); - larvitsmpp.pduToObj(pdu, function(err, obj) { + larvitsmpp.utils.pduToObj(pdu, function(err, obj) { assert( ! err, 'Error should be negative'); assert(obj.cmdId === 2, 'Command ID should be 2'); @@ -62,10 +62,10 @@ describe('PDU convertion', function() { it('should create a return PDU without error', function(done) { var pdu = new Buffer('0000002f000000020000000000000001534d50503354455354007365637265743038005355424d4954310000010100', 'hex'); - larvitsmpp.pduReturn(pdu, function(err, retPdu) { + larvitsmpp.utils.pduReturn(pdu, function(err, retPdu) { assert( ! err, 'Error should be negative'); - larvitsmpp.pduToObj(retPdu, function(err, retObj) { + larvitsmpp.utils.pduToObj(retPdu, function(err, retObj) { assert( ! err, 'Error should be negative'); assert(retObj.cmdId === 2147483650, 'Command ID should be 2147483650'); @@ -81,7 +81,7 @@ describe('PDU convertion', function() { it('should read a submit_sm with an ending NULL octet to the short_message', function(done) { var pdu = new Buffer('0000003c0000000400000000000000020001003436373031313333313131000101343637303937373133333700000000000000000100047465737400', 'hex'); - larvitsmpp.pduToObj(pdu, function(err, obj) { + larvitsmpp.utils.pduToObj(pdu, function(err, obj) { assert( ! err, 'Error should be negative'); assert(obj.params.short_message === 'test', 'Param short_message should read "test"'); @@ -94,7 +94,7 @@ describe('PDU convertion', function() { it('should read a submit_sm without an ending NULL octet to the short_message', function(done) { var pdu = new Buffer('0000003b00000004000000000000000200010034363730313133333131310001013436373039373731333337000000000000000001000474657374', 'hex'); - larvitsmpp.pduToObj(pdu, function(err, obj) { + larvitsmpp.utils.pduToObj(pdu, function(err, obj) { assert( ! err, 'Error should be negative'); assert(obj.params.short_message === 'test', 'Param short_message should read "test"'); @@ -105,7 +105,7 @@ describe('PDU convertion', function() { }); it('should create a very simple submit_sm PDU', function(done) { - larvitsmpp.objToPdu({ + larvitsmpp.utils.objToPdu({ 'cmdName': 'submit_sm', 'cmdStatus': 'ESME_ROK', 'seqNr': 12, @@ -124,7 +124,7 @@ describe('PDU convertion', function() { }); it('should create a submit_sm PDU with UCS2 encoding', function(done) { - larvitsmpp.objToPdu({ + larvitsmpp.utils.objToPdu({ 'cmdName': 'submit_sm', 'cmdStatus': 'ESME_ROK', 'seqNr': 12, @@ -147,7 +147,7 @@ describe('PDU convertion', function() { it('should extract TLVs from a PDU', function(done) { var pdu = new Buffer('000000e9000000050000000002a82e8600010134363730393737313333370000003436373031313133333131000400000000000000007569643a313535303430363231323432313433353835207375623a30303120646c7672643a303031207375626d697420646174653a3135303430363233323420646f6e6520646174653a3135303430363233323420737461743a44454c49565244206572723a3030303020746578743a202062616666042300030300000427000102001e001331353530343036323132343231343335383500141800040000076c145400040000000114160006323430303800', 'hex'); - larvitsmpp.pduToObj(pdu, function(err, obj) { + larvitsmpp.utils.pduToObj(pdu, function(err, obj) { assert( ! err, 'Error should be negative'); assert(obj.cmdId.toString(16) === '5', 'Command ID should be 0x00000005 (5)'); @@ -185,10 +185,10 @@ describe('PDU convertion', function() { } }; - larvitsmpp.objToPdu(pduObj, function(err, pduBuf) { + larvitsmpp.utils.objToPdu(pduObj, function(err, pduBuf) { assert( ! err, 'Error should be negative'); - larvitsmpp.pduToObj(pduBuf, function(err, pduObj2) { + larvitsmpp.utils.pduToObj(pduBuf, function(err, pduObj2) { assert( ! err, 'Error should be negative'); console.log(pduObj2);