1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
6 import { Person } from '../core';
7 import { UnsupportedFeatureError } from '../core/Errors';
9 import Form1040, { FilingStatus } from './Form1040';
10 import ScheduleA from './ScheduleA';
11 import TaxReturn from './TaxReturn';
12 import W2 from './W2';
14 test('medical and dental expenses, limited', () => {
15 const p = Person.self('A');
16 const tr = new TaxReturn();
23 tr.addForm(new Form1040({
24 filingStatus: FilingStatus.Single
27 const f = new ScheduleA({
28 medicalAndDentalExpenses: 250,
32 expect(f.getValue(tr, '2')).toBe(3000);
33 expect(f.getValue(tr, '4')).toBe(25);
34 expect(f.getValue(tr, '17')).toBe(25);
37 test('medical and dental expenses, excluded', () => {
38 const p = Person.self('A');
39 const tr = new TaxReturn();
41 tr.addForm(new Form1040({
42 filingStatus: FilingStatus.Single
50 const f = new ScheduleA({
51 medicalAndDentalExpenses: 250,
55 expect(tr.getForm(Form1040).getValue(tr, '7b')).toBe(300000);
56 expect(f.getValue(tr, '2')).toBe(300000);
57 expect(f.getValue(tr, '4')).toBe(0);
60 test('state and local taxes, un-limited', () => {
61 const tr = new TaxReturn();
62 tr.addForm(new Form1040({
63 filingStatus: FilingStatus.MarriedFilingJoint
66 const f = new ScheduleA({
67 stateAndLocalIncomeAndSalesTaxes: 3000,
68 stateAndLocalRealEstateTaxes: 475,
69 stateAndLocalPropertyTaxes: 225,
73 expect(f.getValue(tr, '5d')).toBe(3700);
74 expect(f.getValue(tr, '5e')).toBe(3700);
75 expect(f.getValue(tr, '17')).toBe(3700);
78 test('state and local taxes, limited', () => {
79 const tr = new TaxReturn();
80 tr.addForm(new Form1040({
81 filingStatus: FilingStatus.MarriedFilingJoint
84 const f = new ScheduleA({
85 stateAndLocalIncomeAndSalesTaxes: 21124,
89 expect(f.getValue(tr, '5d')).toBe(21124);
90 expect(f.getValue(tr, '5e')).toBe(10000);
91 expect(f.getValue(tr, '17')).toBe(10000);
94 test('charitable gifts', () => {
95 const tr = new TaxReturn();
96 tr.addForm(new Form1040({
97 filingStatus: FilingStatus.MarriedFilingJoint
100 const f = new ScheduleA({
101 charitableGiftsCashOrCheck: 3000,
102 charitableGiftsOther: 100,
103 charitableCarryOver: 22,
107 expect(f.getValue(tr, '14')).toBe(3122);
108 expect(f.getValue(tr, '17')).toBe(3122);
111 test('all inputs', () => {
112 const p = Person.self('A');
113 const tr = new TaxReturn();
120 tr.addForm(new Form1040({
121 filingStatus: FilingStatus.Single
124 const f = new ScheduleA({
125 medicalAndDentalExpenses: 250,
126 stateAndLocalIncomeAndSalesTaxes: 1000,
127 stateAndLocalRealEstateTaxes: 1000,
128 stateAndLocalPropertyTaxes: 1000,
130 unreportedMortgageInterest: 1000,
131 unreportedMortagePoints: 1000,
132 mortgageInsurancePremiums: 1000,
133 investmentInterest: 1000,
134 charitableGiftsCashOrCheck: 1000,
135 charitableGiftsOther: 1000,
136 charitableCarryOver: 1000,
137 casualtyAndTheftLosses: 1000,
141 expect(f.getValue(tr, '17')).toBe(12025);