Commit da1846f7cb2e53620b6a1871b5a0949a8adfe315
1 parent
4f1375b5dc
Exists in
master
Perbaikan deteksi keyval pada calculateBaseBillAmount
Showing 2 changed files with 8 additions and 3 deletions Side-by-side Diff
index.js
... | ... | @@ -144,8 +144,8 @@ function splitPostpaidDetail(str) { |
144 | 144 | } |
145 | 145 | |
146 | 146 | function calculateBaseBillAmountAuto(detailSplitted, customKeywords, productKeyval) { |
147 | - const tagihanAsliKeyvalKeywords = ((productKeyval && productKeyval.KEYWORD_TAGASLI) || '') | |
148 | - .split(/ *, */); | |
147 | + const tagihanAsliKeyvalKeywords = (productKeyval && productKeyval.KEYWORD_TAGASLI) ? productKeyval.KEYWORD_TAGASLI.split(/ *, */) | |
148 | + : null; | |
149 | 149 | |
150 | 150 | const keywords = (tagihanAsliKeyvalKeywords && Array.isArray(tagihanAsliKeyvalKeywords) && tagihanAsliKeyvalKeywords.length && tagihanAsliKeyvalKeywords) |
151 | 151 | || customKeywords |
test/main.js
1 | +/* eslint-disable no-console */ | |
1 | 2 | /* global describe it */ |
2 | 3 | |
3 | 4 | //process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG = 'YES'; |
... | ... | @@ -174,8 +175,12 @@ describe('#irs', function() { |
174 | 175 | it('should return correct value - payment', () => { |
175 | 176 | const detail = 'S/N: 0BNS25G5082152526173/NAMA:DONAR-HARHAP/DAYA:900/TARIF:R1M/JMLBLN:2BLN/PERIODE:201910,201911/METERKINI:5508/METERLALU:5508/TAGIHAN:131560/ADM:5000/DENDA:9000/TOTALBAYAR:145560'; |
176 | 177 | const splitted = irs.splitPostpaidDetail(detail); |
178 | + | |
179 | + // console.log('--- DEBUG'); | |
180 | + // console.log(splitted); | |
181 | + // console.log('---'); | |
177 | 182 | |
178 | - irs.calculateBaseBillAmount(splitted).should.equal(140560); | |
183 | + irs.calculateBaseBillAmount(splitted).should.equal(140560, '#2CBDCEB8'); | |
179 | 184 | |
180 | 185 | }) |
181 | 186 | }); |