UNPKG

@hundert11/sv-steuer-rechner

Version:

Calculates the real profit for an Austrian Freelancer

52 lines (46 loc) 2.64 kB
import test from 'node:test'; import assert from 'node:assert/strict'; import { SVbeitrag } from '../src/sv.js'; import { fixValues, percentages } from '../src/sv-values.js'; // Wenn Sie weniger als 6.221,28 € Gewinn pro Jahr selbstständig erzielen, können Sie // sich bei der SVA von der Kranken- und Pensionsversicherung ausnehmen lassen. // Sie bezahlen dann für Ihre Selbstständigkeit nur mehr die Unfallversicherung. test('should return minimum SV-Beitrag if profit is smaller than the current year limit', () => { const year = 2024; const options = { year, tipps: new Set() }; assert.equal(SVbeitrag(fixValues[year].limit - 1, options).toPay, fixValues[year].uv * 12); // 12 months Unfallversicherung assert.equal(options.tipps.has('EXCLUDE_KV_PV'), true); }); test('should return SV-Beitrag for the founding year', () => { const year = 2024; const months = 10; const options = { year, foundingYear: year, foundingMonth: 3, tipps: new Set() }; const { limit, uv, kvMinBeitragsgrundlage, pvMinBeitragsgrundlage, svsMinBeitragsgrundlage } = fixValues[year]; const profitOnEStBescheid = limit; assert.ok(Math.abs(SVbeitrag(profitOnEStBescheid, options).toPay - ( uv + kvMinBeitragsgrundlage * percentages(year).kv + pvMinBeitragsgrundlage * percentages(year).pv + svsMinBeitragsgrundlage * percentages(year).vorsorge ) * months) < 0.005); }); test('should return the correct SV-Beitrag for 10.000€ (older founding year)', () => { const year = 2024; const options = { year, foundingYear: 2020, tipps: new Set() }; const profit = 10000; // = Einkommen lt. EStB const haudeSvValue = 2819; // value from haude Rechner (can use the value here because it's not based on ESt) assert.equal(Math.round(SVbeitrag(profit, options).toPay), haudeSvValue); }); // https://blog.hellerconsult.com/wie-wird-die-sva-berechnet-und-mit-welchen-nachzahlungen-muss-ich-rechnen/ test('should return the correct SV-Nachzahlung for 10.000€ (year = founding year)', () => { const year = 2024; const options = { year, foundingYear: year, tipps: new Set() }; const profit = 10000; // = Einkommen lt. EStB const haudeSvValues = [1805, 429]; // values from WKO & haude Rechner const { toPay, additionalPayment } = SVbeitrag(profit, options); assert.equal(Math.round(toPay), haudeSvValues[0]); // somehow the additional payment is not exactly the same as in the haude Rechner // we've got 499 instead of 429, TODO: check why there is a 70€ difference assert.ok(Math.round(additionalPayment) > haudeSvValues[1]); assert.ok(Math.round(additionalPayment) < haudeSvValues[1] + 100); });