diff --git a/index.js b/index.js index 25d5085..d43966c 100644 --- a/index.js +++ b/index.js @@ -144,8 +144,8 @@ function splitPostpaidDetail(str) { } function calculateBaseBillAmountAuto(detailSplitted, customKeywords, productKeyval) { - const tagihanAsliKeyvalKeywords = ((productKeyval && productKeyval.KEYWORD_TAGASLI) || '') - .split(/ *, */); + const tagihanAsliKeyvalKeywords = (productKeyval && productKeyval.KEYWORD_TAGASLI) ? productKeyval.KEYWORD_TAGASLI.split(/ *, */) + : null; const keywords = (tagihanAsliKeyvalKeywords && Array.isArray(tagihanAsliKeyvalKeywords) && tagihanAsliKeyvalKeywords.length && tagihanAsliKeyvalKeywords) || customKeywords diff --git a/test/main.js b/test/main.js index e7927bb..446db31 100644 --- a/test/main.js +++ b/test/main.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ /* global describe it */ //process.env.KOMODO_SDK_DEBUG_RC_FROM_MSG = 'YES'; @@ -174,8 +175,12 @@ describe('#irs', function() { it('should return correct value - payment', () => { 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'; const splitted = irs.splitPostpaidDetail(detail); + + // console.log('--- DEBUG'); + // console.log(splitted); + // console.log('---'); - irs.calculateBaseBillAmount(splitted).should.equal(140560); + irs.calculateBaseBillAmount(splitted).should.equal(140560, '#2CBDCEB8'); }) });