Skip to content

Commit

Permalink
fix(account): footer was wrongly parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
MathRobin committed Feb 28, 2024
1 parent 7f80e5b commit b6fcac5
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [18, 20, 21]
version: [18, 20]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
49 changes: 49 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# GENERATED FILE - Do not edit manually

# Ignore artifacts:
coverage
.yarn
.idea
node_modules
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Static Badge](https://img.shields.io/badge/coverage-87.86-brightgreen)
![Static Badge](https://img.shields.io/badge/release-1.13.6-blue)
![Static Badge](https://img.shields.io/badge/coverage-82.56-brightgreen)
![Static Badge](https://img.shields.io/badge/release-1.13.9-blue)
[![test](https://github.com/airporting/ebics-parser/actions/workflows/test.yml/badge.svg)](https://github.com/airporting/ebics-parser/actions/workflows/test.yml)

# ebics-parser
Expand All @@ -9,7 +9,7 @@ Lightweight and very fast parser, only two dep (date-fns, joi).

Used by [Airporting](https://www.airporting.com)

NodeJs 18.x or newer only.
Tested on NodeJS 18.x and 20.x

[![Linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/airporting)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airporting/ebics-parser",
"version": "1.13.8",
"version": "1.13.9",
"main": "src/index.js",
"repository": "git@github.com:airporting/ebics-parser.git",
"author": "mathrobin <mthrobin@gmail.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function chunkParser(allLines) {
transactionsList.push(currentTransaction.transaction);
}

footer = footerParser(line.split(/(\s+)/));
footer = footerParser(line);

endAmount = footer.next_amount;

Expand Down
85 changes: 85 additions & 0 deletions src/account/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00071',
Expand Down Expand Up @@ -77,6 +82,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00823',
Expand Down Expand Up @@ -120,6 +130,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30056',
desk_code: '00917',
Expand Down Expand Up @@ -174,6 +189,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00585',
Expand Down Expand Up @@ -295,6 +315,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '18020',
desk_code: '00001',
Expand Down Expand Up @@ -591,6 +616,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '18020',
desk_code: '00001',
Expand Down Expand Up @@ -756,6 +786,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '18020',
desk_code: '00001',
Expand Down Expand Up @@ -866,6 +901,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '18020',
desk_code: '00001',
Expand Down Expand Up @@ -909,6 +949,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '18020',
desk_code: '00001',
Expand Down Expand Up @@ -959,6 +1004,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30003',
desk_code: '01678',
Expand Down Expand Up @@ -1080,6 +1130,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: 'C',
record_code: '07',
bank_code: '30003',
desk_code: '03300',
Expand Down Expand Up @@ -1203,6 +1258,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00071',
Expand Down Expand Up @@ -1426,6 +1486,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00585',
Expand Down Expand Up @@ -1516,6 +1581,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '30004',
desk_code: '00760',
Expand Down Expand Up @@ -1712,6 +1782,11 @@ describe('account', function () {
_5: '030323060323',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '10278',
desk_code: '06186',
Expand Down Expand Up @@ -1791,6 +1866,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '10207',
desk_code: '00233',
Expand Down Expand Up @@ -1859,6 +1939,11 @@ describe('account', function () {
_5: '',
},
footer: {
_1: '',
_2: '',
_3: '',
_4: '',
_5: '',
record_code: '07',
bank_code: '10207',
desk_code: '00233',
Expand Down
5 changes: 5 additions & 0 deletions src/account/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ module.exports = () => {
account_nb: Joi.string(),
next_date: Joi.string(),
next_amount: Joi.string(),
_1: Joi.string().empty('').optional(),
_2: Joi.string().empty('').optional(),
_3: Joi.string().empty('').optional(),
_4: Joi.string().empty('').optional(),
_5: Joi.string().empty('').optional(),
}),
transactions: Joi.array().items(transactionSchema),
problems: Joi.array()
Expand Down
Loading

0 comments on commit b6fcac5

Please sign in to comment.