Modified tests to match new file structure

This commit is contained in:
2015-05-01 12:44:41 +02:00
parent 24aec3073c
commit 93379a328d
3 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -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() {
+1 -1
View File
@@ -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;
+13 -13
View File
@@ -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);