import { signedGlBalances } from './omnl-fineract-office-gl';

describe('signedGlBalances', () => {
  it('aggregates flat Fineract journal lines (Hybx format)', () => {
    const glById = new Map([
      [1, { glCode: '1000', name: 'Reserve assets' }],
      [14, { glCode: '13010', name: 'Nostro' }],
    ]);
    const rows = signedGlBalances(
      [
        { glAccountId: 1, amount: 900000000000, entryType: 'DEBIT' },
        { glAccountId: 14, amount: 999998500, entryType: 'DEBIT' },
      ],
      glById,
    );
    expect(rows.find((r) => r.glCode === '1000')).toMatchObject({ side: 'Dr', amount: '900000000000.00' });
    expect(rows.find((r) => r.glCode === '13010')).toMatchObject({ side: 'Dr', amount: '999998500.00' });
  });
});
