Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daňový bonus na zaplatené úroky hypoteka #860

Merged
merged 39 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cb8b5c9
pridaj ziadam vyplatit preplatok na urokoch
MarekVigas Feb 8, 2024
1d47063
add structure based on partner bonus for uroky
MarekVigas Feb 9, 2024
ffe80f3
Merge branch 'master' into 737-daňový-bonus-na-zaplatené-úroky-hypoteka
MarekVigas Feb 14, 2024
bceb238
Merge branch 'master' into 737-daňový-bonus-na-zaplatené-úroky-hypoteka
MarekVigas Feb 21, 2024
5796ee6
add basic steps
MarekVigas Feb 21, 2024
d5ac251
Merge branch 'master' into 737-daňový-bonus-na-zaplatené-úroky-hypoteka
MarekVigas Feb 21, 2024
e61597d
fix build
MarekVigas Feb 21, 2024
dc8e426
add negative pass of hypoteka
MarekVigas Feb 21, 2024
a8dd5e7
remove old test case inputs
MarekVigas Feb 21, 2024
a21ab66
map calc in converter to output
MarekVigas Feb 21, 2024
dd559d8
add calc and mapping for uver
MarekVigas Feb 21, 2024
4d3bf5d
fix cypress tests
MarekVigas Feb 22, 2024
d3cec70
remove old test inputs
MarekVigas Feb 22, 2024
7ff4d92
fix route unit tests
MarekVigas Feb 22, 2024
7f306cd
add validations
MarekVigas Feb 22, 2024
9dda9c8
remove unused import
MarekVigas Feb 22, 2024
059a9a4
fix cypress tests
MarekVigas Feb 22, 2024
e1191d3
fix unit tests
MarekVigas Feb 22, 2024
2eda93c
vyplatenie danoveho bonusu
MarekVigas Feb 22, 2024
5cc250e
clean up
MarekVigas Feb 22, 2024
f20dc0f
add basic calcs
MarekVigas Feb 22, 2024
da72aa4
vypocitaj iba ak sa uplatnuje danovy bonus na uroky
MarekVigas Feb 22, 2024
52a43f8
add positive pass of uroky
MarekVigas Feb 22, 2024
1256f0f
ad first tests for uroky
MarekVigas Feb 22, 2024
d7d8104
add basic tests
MarekVigas Feb 22, 2024
672d365
fix calc
MarekVigas Feb 23, 2024
79f606b
update input
MarekVigas Feb 23, 2024
12f08b8
fix typo in test
MarekVigas Feb 23, 2024
8ea50d3
full calc for riadok 135
MarekVigas Feb 23, 2024
3c59bf2
add new test cases
MarekVigas Feb 23, 2024
b211751
fix calc
MarekVigas Feb 23, 2024
f008dff
rename tests
MarekVigas Feb 23, 2024
e2009df
fix 2% check
MarekVigas Feb 23, 2024
3ea649d
add more test cases
MarekVigas Feb 23, 2024
49625d4
add summary
MarekVigas Feb 23, 2024
160f67e
fix expected ngo donation
MarekVigas Feb 23, 2024
028f321
add test case
MarekVigas Feb 23, 2024
68e6dc9
remove old todo
MarekVigas Feb 23, 2024
5832ea8
add validation
MarekVigas Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 109 additions & 18 deletions __tests__/hypoteka.test.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,133 @@
import { validate } from '../src/pages/hypoteka'
import { TAX_YEAR } from '../src/lib/calculation'
import { validate } from '../src/pages/uroky'
import { testValidation } from './utils/testValidation'

describe('hypoteka', () => {
describe.only('hypoteka', () => {
describe('#validate', () => {
testValidation(validate, [
{
input: { r037_uplatnuje_uroky: undefined },
expected: ['r037_uplatnuje_uroky'],
input: { r035_uplatnuje_uroky: undefined },
expected: ['r035_uplatnuje_uroky'],
},
{ input: { r037_uplatnuje_uroky: false }, expected: [] },
{ input: { r035_uplatnuje_uroky: false }, expected: [] },
{
input: { r037_uplatnuje_uroky: true },
expected: ['r037_zaplatene_uroky', 'r037_pocetMesiacov'],
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 1,
},
expected: ['uroky_dalsi_uver_uplatnuje'],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 2,
},
expected: ['uroky_rok_uzatvorenia', 'uroky_zaciatok_urocenia_den', 'uroky_zaciatok_urocenia_mesiac', 'uroky_zaciatok_urocenia_rok'],
},
{
input: {
r035_uplatnuje_uroky: true,
uroky_rok_uzatvorenia: TAX_YEAR-1,
hypoteka_step: 2,
},
expected: ['uroky_zaciatok_urocenia_den', 'uroky_zaciatok_urocenia_mesiac', 'uroky_zaciatok_urocenia_rok'],
},
{
input: {
r035_uplatnuje_uroky: true,
uroky_rok_uzatvorenia: TAX_YEAR-1,
uroky_zaciatok_urocenia_den: '1',
uroky_zaciatok_urocenia_mesiac: '1',
uroky_zaciatok_urocenia_rok: TAX_YEAR-1,
hypoteka_step: 2,
},
expected: [],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 3,
},
expected: ['uroky_dalsi_dlznik'],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 3,
uroky_dalsi_dlznik: true,
},
expected: ['uroky_pocet_dlznikov'],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 3,
uroky_dalsi_dlznik: false,
},
expected: [],
},
{
input: {
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: 'a',
r037_pocetMesiacov: 'b',
r035_uplatnuje_uroky: true,
hypoteka_step: 4,
},
expected: ['r037_zaplatene_uroky', 'r037_pocetMesiacov'],
expected: ['uroky_splnam_vek_kriteria'],
},
{
input: {
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '10',
r037_pocetMesiacov: '20',
r035_uplatnuje_uroky: true,
hypoteka_step: 4,
uroky_splnam_vek_kriteria: true,
},
expected: ['r037_pocetMesiacov'],
expected: [],
},
{
input: {
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '10',
r037_pocetMesiacov: '12',
r035_uplatnuje_uroky: true,
hypoteka_step: 5,
},
expected: ['uroky_splnam_prijem'],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 5,
uroky_splnam_prijem: true,
},
expected: [],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 6,
r035_zaplatene_uroky: undefined,
},
expected: ['r035_zaplatene_uroky'],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 6,
r035_zaplatene_uroky: '123,45',
},
expected: [],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 6,
r035_zaplatene_uroky: '123.45',
},
expected: [],
},
{
input: {
r035_uplatnuje_uroky: true,
hypoteka_step: 6,
r035_zaplatene_uroky: '123,45a',
},
expected: ['r035_zaplatene_uroky'],
}
])
})
})
4 changes: 4 additions & 0 deletions __tests__/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('routes', () => {
'/partner',
'/deti',
'/dochodok',
'/uroky',
'/dve-percenta',
'/osobne-udaje',
'/suhrn',
Expand All @@ -36,6 +37,7 @@ describe('routes', () => {
'/partner',
'/deti',
'/dochodok',
'/uroky',
'/dve-percenta',
'/osobne-udaje',
'/suhrn',
Expand All @@ -56,6 +58,7 @@ describe('routes', () => {
'/partner',
'/deti',
'/dochodok',
'/uroky',
'/dve-percenta',
'/osobne-udaje',
'/suhrn',
Expand All @@ -77,6 +80,7 @@ describe('routes', () => {
'/partner',
'/deti',
'/dochodok',
'/uroky',
'/dve-percenta',
'/osobne-udaje',
'/suhrn',
Expand Down
2 changes: 0 additions & 2 deletions __tests__/testCases/bugReport1Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const bugReport1Input: E2eTestUserInput = {
],
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '',
r037_pocetMesiacov: '',
r037_zaplatene_uroky: '',
expectNgoDonationValue: false,
r142_ico: '',
r142_obchMeno: '',
Expand Down
2 changes: 0 additions & 2 deletions __tests__/testCases/bugReport2aInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export const bugReport2aInput: E2eTestUserInput = {
],
platil_prispevky_na_dochodok: true,
zaplatene_prispevky_na_dochodok: '100',
r037_pocetMesiacov: '',
r037_zaplatene_uroky: '',
expectNgoDonationValue: true,
XIIoddiel_uplatnujem2percenta: false,
r142_ico: '',
Expand Down
2 changes: 0 additions & 2 deletions __tests__/testCases/bugReport2bInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const bugReport2bInput: E2eTestUserInput = {
children: [],
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
r037_pocetMesiacov: '',
r037_zaplatene_uroky: '',
expectNgoDonationValue: true,
XIIoddiel_uplatnujem2percenta: false,
r142_ico: '',
Expand Down
2 changes: 0 additions & 2 deletions __tests__/testCases/bugReport3Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ export const bugReport3Input: E2eTestUserInput = {
],
platil_prispevky_na_dochodok: true,
zaplatene_prispevky_na_dochodok: '100',
r037_pocetMesiacov: '',
r037_zaplatene_uroky: '',
expectNgoDonationValue: true,
XIIoddiel_uplatnujem2percenta: false,
r142_ico: '',
Expand Down
2 changes: 0 additions & 2 deletions __tests__/testCases/bugReport5Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export const bugReport5Input: E2eTestUserInput = {
],
"platil_prispevky_na_dochodok": true,
"zaplatene_prispevky_na_dochodok": "180",
"r037_pocetMesiacov": "",
"r037_zaplatene_uroky": "",
"expectNgoDonationValue": true,
"XIIoddiel_uplatnujem2percenta": true,
"splnam3per": false,
Expand Down
3 changes: 1 addition & 2 deletions __tests__/testCases/bugReport6Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const bugReport6Input: E2eTestUserInput = {
],
"platil_prispevky_na_dochodok": false,
"zaplatene_prispevky_na_dochodok": "",
"r037_pocetMesiacov": "",
"r037_zaplatene_uroky": "",

"splnam3per": false,
"r142_ico": "",
"r142_obchMeno": "",
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202201Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202201Input: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '1084.26',
employed: true,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202202aInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202202aInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202202bInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202202bInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202202cInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202202cInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202202dInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202202dInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202203Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202203Input: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202204Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202204Input: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '848.52',
employed: true,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/case202205Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const case202205Input: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '0',
employed: false,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: false,
zaplatene_prispevky_na_dochodok: '0',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/completeDecimalInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ export const completeDecimalInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '50.75',
employed: true,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200,32',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: true,
zaplatene_prispevky_na_dochodok: '170,32',
Expand Down
5 changes: 0 additions & 5 deletions __tests__/testCases/completeInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const completeInput: E2eTestUserInput = {
udajeODanovomBonuseNaDieta: '50',
employed: true,

/** SECTION Mortgage */
r037_uplatnuje_uroky: true,
r037_zaplatene_uroky: '200',
r037_pocetMesiacov: '12',

/** SECTION Pension */
platil_prispevky_na_dochodok: true,
zaplatene_prispevky_na_dochodok: '180',
Expand Down
15 changes: 15 additions & 0 deletions __tests__/testCases/uroky202301aInput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TAX_YEAR } from '../../src/lib/calculation'
import { E2eTestUserInput } from '../../src/types/E2eTestUserInput'
import { case202301Input } from './case202301Input'

export const uroky202301aInput: E2eTestUserInput = {
...case202301Input,
r035_uplatnuje_uroky: true,
uroky_rok_uzatvorenia: (TAX_YEAR - 3).toString(),
uroky_zaciatok_urocenia_den: '21',
uroky_zaciatok_urocenia_mesiac: '8',
uroky_zaciatok_urocenia_rok: (TAX_YEAR - 3).toString(),
uroky_dalsi_dlznik: true,
uroky_pocet_dlznikov: '2',
r035_zaplatene_uroky: '987.65',
}
15 changes: 15 additions & 0 deletions __tests__/testCases/uroky202301bInput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TAX_YEAR, UROKY_POCET_ROKOV } from '../../src/lib/calculation'
import { E2eTestUserInput } from '../../src/types/E2eTestUserInput'
import { case202301Input } from './case202301Input'

export const uroky202301bInput: E2eTestUserInput = {
...case202301Input,
r035_uplatnuje_uroky: true,
uroky_rok_uzatvorenia: (TAX_YEAR - UROKY_POCET_ROKOV).toString(),
uroky_zaciatok_urocenia_den: '21',
uroky_zaciatok_urocenia_mesiac: '8',
uroky_zaciatok_urocenia_rok: (TAX_YEAR - UROKY_POCET_ROKOV).toString(),
uroky_dalsi_dlznik: true,
uroky_pocet_dlznikov: '2',
r035_zaplatene_uroky: '987.65',
}
Loading
Loading