From 1c28ac0424506cff01f74c3d47471f2711b41e1a Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Fri, 11 Sep 2020 14:58:58 +0700
Subject: [PATCH] Update parsing untuk tajir reload

---
 index.js     |  2 +-
 test/main.js | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 29af8cd..b36710b 100644
--- a/index.js
+++ b/index.js
@@ -100,7 +100,7 @@ function getSnFromMessage(msg, rule) {
 function getBalanceFromMessage(msg, rule) {
     if (!rule) {
         rule = {
-            pattern: "Sisa Saldo: .+? = ([\\d\\.]+) ",
+            pattern: "Saldo: .+? = ([\\d\\.]+) ",
             match_idx: 1
         }
     }
diff --git a/test/main.js b/test/main.js
index b53f5cb..da43dff 100644
--- a/test/main.js
+++ b/test/main.js
@@ -42,6 +42,13 @@ describe('#irs', function() {
             });
         });
 
+        describe('#some suppliers', () => {
+            it('should return correct price', () => {
+                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')
+                    .should.equal(5285, 'tajir price');
+            });
+        });
+
         describe('#custom', () => {
             it('should return correct price', () => {
                 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() {
     });
 
     describe('#getBalanceFromMessage', () => {
+
+        describe('#some suppliers', () => {
+            it('should return correct price', () => {
+                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')
+                    .should.equal(2278726, 'tajir balance');
+            });
+        });
+
+
         describe('#custom', () => {
             it('should return correct price', () => {
                 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';
-- 
1.9.0