Skip to content

Commit

Permalink
✨ (api): 添加中国邮政储蓄银行支出规则测试用例
Browse files Browse the repository at this point in the history
添加中国邮政储蓄银行支出规则测试用例,以确保代码的正确性和完整性。
  • Loading branch information
AnkioTomas committed Sep 19, 2024
1 parent d0b3eb2 commit a80b988
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@ const TITLES_BOC = ['交易提醒'];
// 正则表达式和处理函数的映射关系
const regexMapBOC = [
[
//交易时间:2024年09月18日08:18\n交易类型:(尾号8057)快捷支付\n交易金额:(人民币)24.92元
//交易时间:2024年06月14日23:19\n交易类型:(尾号7618)薪酬\n交易金额:(人民币)8683.33元
/交易时间:(.*?)\n交易类型:\(尾号(\d+)\)(.*?)\n交易金额:\(人民币\)([\d,]+.\d{2})元/,
match => {
let [, time,number,shopItem,money] = match;
let type = BillType.Income;
let typeName = "收入"
if (shopItem.indexOf("支付")!==-1){
type = BillType.Expend;
typeName = "支出"
}


return {
"money": toFloat(match[4]),
"type": BillType.Income,
"time": match[1],
"shopItem": match[3],
"accountNameFrom": `${SOURCE_NAME_BOC}(${match[2]})`,
"money": toFloat(money),
"type": type,
"time":time,
"shopItem": shopItem,
"accountNameFrom": `${SOURCE_NAME_BOC}(${number})`,
"Currency": Currency['人民币'],
"channel": `微信[${SOURCE_NAME_BOC}-收入]`,
"channel": `微信[${SOURCE_NAME_BOC}-${typeName}]`,
};
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ test('中国邮政储蓄银行收入', () =>
"channel": '微信[中国邮政储蓄银行-收入]',
},
]));
test('中国邮政储蓄银行支出', () =>
testAnkio('中国邮政储蓄银行支出', [
{
"type": "Expend",
"money": 24.92,
"fee": 0,
"shopName": '',
"shopItem": '快捷支付',
"accountNameFrom": '中国邮政储蓄银行(8057)',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('2024年09月18日08:18', 'Y年M月D日h:i'),
"channel": '微信[中国邮政储蓄银行-支出]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mMap":{"tableName":"AppMessage","description":"交易时间:2024年09月18日08:18\n交易类型:(尾号8057)快捷支付\n交易金额:(人民币)24.92元","source":"中国邮政储蓄银行","arg":"msgId","type":5,"appId":"","msgId":554442,"title":"交易提醒"}}

0 comments on commit a80b988

Please sign in to comment.