test.js
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var assert = require("assert");
describe('aaa', function() {
var aaa = require('./aaa');
describe("#unaliasResponseCode()", function() {
it('should return 68', function() {
assert.equal('68', aaa.unaliasResponseCode('01', '01:68'));
});
it('should return 68', function() {
assert.equal('68', aaa.unaliasResponseCode('68', '01:68'));
});
it('should return 00', function() {
assert.equal('00', aaa.unaliasResponseCode('00', '01:68'));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40', ''));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40', ''));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40'));
});
});
});
describe('aaa', function() {
var partner = require('./httppulsakita');
describe("#parseResult()", function() {
message = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><respon><tanggal>2015/6/16 15:43:35</tanggal><idagen>P0039</idagen><refid>AEE15B32987941D89FFF4BC7EF676C13</refid><produk>PLN20</produk><tujuan>14204279369</tujuan><rc>0000</rc><data> </data><token> </token><pesan>#14836 PLN20 ke:14204279369 SUKSES. SN:3520-2887-6627-6699-4826/TestDummyPanjang6955555/P1/7000VA/32,4. \
Sisa saldo Rp. 5,000,000 - Rp. 18,700 = Rp. 4,981,300</pesan></respon>';
data = partner.parseResult(message);
console.log(data);
it('should return 2015/6/16 15:43:35', function() {
assert.equal('2015/6/16 15:43:35', data.respon.tanggal);
});
});
});