Commit 0204ba4880843e467f86e9d587912077cbe429f7

Authored by Adhidarma Hadiwinoto
1 parent c453c120cc
Exists in master

Protheus tested

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

1 1 /* eslint-disable no-console */
2   -"use strict";
3   -
4 2 const regexLooperReplace = require('tektrans-lib/regex-looper/replace');
5 3 const rcFromMsg = require('komodo-sdk/rc-from-msg');
6 4 const organicRc = require('./rc');
... ... @@ -0,0 +1,31 @@
  1 +/* global describe it */
  2 +
  3 +require('should');
  4 +
  5 +const irs = require('../index');
  6 +
  7 +describe('#main', () => {
  8 + describe('#getPriceFromMessage', () => {
  9 + it('should return correct value', () => {
  10 + irs.getPriceFromMessage(
  11 + 'RC00 SUKSES Transaksi TSEL15 ke 081382709997 success, SN: 02120300000626854613 Harga Beli : 14820 Sisa Saldo : 5638 RestCode : 00 ResellerTrxID : 9763834',
  12 + {
  13 + pattern: 'Harga Beli : (\\d+)',
  14 + match_idx: 1,
  15 + },
  16 + ).should.equal(14820);
  17 + });
  18 + });
  19 +
  20 + describe('#getBalanceFromMessage', () => {
  21 + it('should return correct value', () => {
  22 + irs.getBalanceFromMessage(
  23 + 'RC00 SUKSES Transaksi TSEL15 ke 081382709997 success, SN: 02120300000626854613 Harga Beli : 14820 Sisa Saldo : 5638 RestCode : 00 ResellerTrxID : 9763834',
  24 + {
  25 + pattern: 'Sisa Saldo : (\\d+)',
  26 + match_idx: 1,
  27 + },
  28 + ).should.equal(5638);
  29 + });
  30 + });
  31 +});