Commit 51e8e9de9942b126dd5cebf6db9ca3ff1b7e4ffa
1 parent
e3c1fb0ae5
Exists in
master
lgging pas cari sn
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
test.js
1 | var should = require('should'); | 1 | var should = require('should'); |
2 | var crypto = require('crypto'); | 2 | var crypto = require('crypto'); |
3 | 3 | ||
4 | describe('#partner', function () { | 4 | describe('#partner', function () { |
5 | var partner = require('./partner-fm') | 5 | var partner = require('./partner-fm') |
6 | 6 | ||
7 | describe('#composeTopupMessage', function() { | 7 | describe('#composeTopupMessage', function() { |
8 | it('should return correct xml message', function() { | 8 | it('should return correct xml message', function() { |
9 | var msg = partner.composeTopupMessage('1234', 'S10', '08120812', '2345'); | 9 | var msg = partner.composeTopupMessage('1234', 'S10', '08120812', '2345'); |
10 | crypto.createHash('sha256').update(msg, 'utf8').digest().toString('hex').should.equal('1b926cb9101d9b172ae12206d0c10d4800b553f3d9f2e320fe526c7effb11985'); | 10 | crypto.createHash('sha256').update(msg, 'utf8').digest().toString('hex').should.equal('1b926cb9101d9b172ae12206d0c10d4800b553f3d9f2e320fe526c7effb11985'); |
11 | }) | 11 | }) |
12 | }); | 12 | }); |
13 | 13 | ||
14 | describe('#getSnFromMessage', function() { | 14 | describe('#getSnFromMessage', function() { |
15 | it('should return correct sn', function() { | 15 | it('should return correct sn', function() { |
16 | partner.getSnFromMessage('S10.081300000000 berhasil, SN:123456789').should.equal('123456789'); | 16 | partner.getSnFromMessage('IH5.085714777509 Status: SUKSES SN: 1330926551').should.equal('1330926551'); |
17 | }); | 17 | }); |
18 | }) | 18 | }) |
19 | 19 | ||
20 | describe('#modifyMessageWithSn', function() { | 20 | describe('#modifyMessageWithSn', function() { |
21 | it('should return correct sn', function() { | 21 | it('should return correct sn', function() { |
22 | partner.modifyMessageWithSn('S10.081300000000 berhasil.').should.equal('S10.081300000000 berhasil.'); | 22 | partner.modifyMessageWithSn('S10.081300000000 berhasil.').should.equal('S10.081300000000 berhasil.'); |
23 | partner.modifyMessageWithSn('S10.081300000000 berhasil, SN:').should.equal('S10.081300000000 berhasil, SN:'); | 23 | partner.modifyMessageWithSn('S10.081300000000 berhasil, SN:').should.equal('S10.081300000000 berhasil, SN:'); |
24 | partner.modifyMessageWithSn('S10.081300000000 berhasil, SN:123456789').should.equal('SN=123456789; S10.081300000000 berhasil, SN:123456789'); | 24 | partner.modifyMessageWithSn('S10.081300000000 berhasil, SN:123456789').should.equal('SN=123456789; S10.081300000000 berhasil, SN:123456789'); |
25 | partner.modifyMessageWithSn('S10.081300000000 berhasil, SN:123456789. Berita tambahan').should.equal('SN=123456789; S10.081300000000 berhasil, SN:123456789. Berita tambahan'); | 25 | partner.modifyMessageWithSn('IH5.085714777509 Status: SUKSES SN: 1330926551').should.equal('SN=1330926551; IH5.085714777509 Status: SUKSES SN: 1330926551'); |
26 | }); | 26 | }); |
27 | }); | 27 | }); |
28 | }) | 28 | }) |
29 | 29 |