mt940parser/test/test.ts

21 lines
732 B
TypeScript

import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as tapbundleFs from '@push.rocks/tapbundle-fs';
import * as mt940parser from '../ts/index.js';
let testMt940Parser: mt940parser.Mt940Parser;
tap.test('should create a valid instance of Mt940Parser', async () => {
testMt940Parser = new mt940parser.Mt940Parser();
});
tap.test('should parse a set of files', async () => {
const smartfiles = await tapbundleFs.smartfile.fs.fileTreeToObject('.nogit/', '*.mt940');
console.log(smartfiles);
for (const smartfile of smartfiles) {
const statements = await testMt940Parser.parseMt940FileString(smartfile.contents.toString());
console.log(JSON.stringify(statements, null, 2));
}
})
tap.start();