Commit 1c28ac0424506cff01f74c3d47471f2711b41e1a

Authored by Adhidarma Hadiwinoto
1 parent 31176ea6bc
Exists in master

Update parsing untuk tajir reload

Showing 2 changed files with 17 additions and 1 deletions Side-by-side Diff

... ... @@ -100,7 +100,7 @@ function getSnFromMessage(msg, rule) {
100 100 function getBalanceFromMessage(msg, rule) {
101 101 if (!rule) {
102 102 rule = {
103   - pattern: "Sisa Saldo: .+? = ([\d\.]+) ",
  103 + pattern: "Saldo: .+? = ([\d\.]+) ",
104 104 match_idx: 1
105 105 }
106 106 }
... ... @@ -42,6 +42,13 @@ describe('#irs', function() {
42 42 });
43 43 });
44 44  
  45 + describe('#some suppliers', () => {
  46 + it('should return correct price', () => {
  47 + irs.getPriceFromMessage('Trx S10 085212341234 BERHASIL, Harga: 5.285 SN: 41002553325946 Saldo: 2.284.011 - 5.285 = 2.278.726 @24/06/2018 18:38:06')
  48 + .should.equal(5285, 'tajir price');
  49 + });
  50 + });
  51 +
45 52 describe('#custom', () => {
46 53 it('should return correct price', () => {
47 54 const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105';
... ... @@ -56,6 +63,15 @@ describe('#irs', function() {
56 63 });
57 64  
58 65 describe('#getBalanceFromMessage', () => {
  66 +
  67 + describe('#some suppliers', () => {
  68 + it('should return correct price', () => {
  69 + irs.getBalanceFromMessage('Trx S10 085212341234 BERHASIL, Harga: 5.285 SN: 41002553325946 Saldo: 2.284.011 - 5.285 = 2.278.726 @24/06/2018 18:38:06')
  70 + .should.equal(2278726, 'tajir balance');
  71 + });
  72 + });
  73 +
  74 +
59 75 describe('#custom', () => {
60 76 it('should return correct price', () => {
61 77 const msg = 'HX5 No.087781522208 Berhasil SN:99971113094584 Tgl 2019-13-11 12:31:47.Saldo Anda 495.630 - Rp 5.525 = Rp 490.105';