Files
skr/test/test.basic.ts
Juergen Kunz 8a9056e767
Some checks failed
Default (tags) / security (push) Successful in 44s
Default (tags) / test (push) Failing after 4m4s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
feat(core): initial release of SKR03/SKR04 German accounting standards implementation
- Complete implementation of German standard charts of accounts
- SKR03 (Process Structure Principle) for trading/service companies
- SKR04 (Financial Classification Principle) for manufacturing companies
- Double-entry bookkeeping with MongoDB persistence
- Comprehensive reporting suite with DATEV export
- Full TypeScript support and type safety
2025-08-09 12:00:40 +00:00

79 lines
2.8 KiB
TypeScript

import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as skr from '../ts/index.js';
tap.test('should export all required classes and types', async () => {
expect(skr.Account).toBeTypeOf('function');
expect(skr.Transaction).toBeTypeOf('function');
expect(skr.JournalEntry).toBeTypeOf('function');
expect(skr.ChartOfAccounts).toBeTypeOf('function');
expect(skr.Ledger).toBeTypeOf('function');
expect(skr.Reports).toBeTypeOf('function');
expect(skr.SkrApi).toBeTypeOf('function');
expect(skr.SKR03_ACCOUNTS).toBeArray();
expect(skr.SKR04_ACCOUNTS).toBeArray();
});
tap.test('should have correct number of SKR03 accounts', async () => {
expect(skr.SKR03_ACCOUNTS.length).toBeGreaterThan(50);
expect(skr.SKR03_ACCOUNTS[0].skrType).toEqual('SKR03');
});
tap.test('should have correct number of SKR04 accounts', async () => {
expect(skr.SKR04_ACCOUNTS.length).toBeGreaterThan(50);
expect(skr.SKR04_ACCOUNTS[0].skrType).toEqual('SKR04');
});
tap.test('should have valid account structure for SKR03', async () => {
const firstAccount = skr.SKR03_ACCOUNTS[0];
expect(firstAccount.accountNumber).toBeTypeofString();
expect(firstAccount.accountNumber.length).toEqual(4);
expect(firstAccount.accountName).toBeTypeofString();
expect(firstAccount.accountClass).toBeTypeofNumber();
expect(firstAccount.accountType).toMatch(
/^(asset|liability|equity|revenue|expense)$/,
);
});
tap.test('should have valid account structure for SKR04', async () => {
const firstAccount = skr.SKR04_ACCOUNTS[0];
expect(firstAccount.accountNumber).toBeTypeofString();
expect(firstAccount.accountNumber.length).toEqual(4);
expect(firstAccount.accountName).toBeTypeofString();
expect(firstAccount.accountClass).toBeTypeofNumber();
expect(firstAccount.accountType).toMatch(
/^(asset|liability|equity|revenue|expense)$/,
);
});
tap.test('should have account classes 0-9 in SKR03', async () => {
const classes = new Set(skr.SKR03_ACCOUNTS.map((a) => a.accountClass));
expect(classes.size).toBeGreaterThan(5);
// Check that we have accounts in multiple classes
for (let i = 0; i <= 9; i++) {
const accountsInClass = skr.SKR03_ACCOUNTS.filter(
(a) => a.accountClass === i,
);
if (accountsInClass.length > 0) {
expect(accountsInClass[0].accountNumber[0]).toEqual(i.toString());
}
}
});
tap.test('should have account classes 0-9 in SKR04', async () => {
const classes = new Set(skr.SKR04_ACCOUNTS.map((a) => a.accountClass));
expect(classes.size).toBeGreaterThan(5);
// Check that we have accounts in multiple classes
for (let i = 0; i <= 9; i++) {
const accountsInClass = skr.SKR04_ACCOUNTS.filter(
(a) => a.accountClass === i,
);
if (accountsInClass.length > 0) {
expect(accountsInClass[0].accountNumber[0]).toEqual(i.toString());
}
}
});
export default tap.start();