1 // Copyright 2021 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';
8 import Form1040, { FilingStatus } from './Form1040';
9 import { Form1098, MortgageInterestDeductionWorksheet } from './Form1098';
10 import TaxReturn from './TaxReturn';
12 test('grandfathered debt', () => {
13 const p = Person.self('A');
14 const tr = new TaxReturn();
16 tr.addForm(new Form1040({
17 filingStatus: FilingStatus.MarriedFilingJoint,
19 tr.addForm(new Form1098({
22 mortgageInterestReceived: 20_000,
23 outstandingMortgagePrincipal: 2_000_000,
24 mortgageOriginationDate: new Date('1980-01-02'),
26 const ws = new MortgageInterestDeductionWorksheet();
29 expect(ws.getValue(tr, '1')).toBe(2_000_000);
30 expect(ws.getValue(tr, '2')).toBe(0);
31 expect(ws.getValue(tr, '5')).toBe(2_000_000);
32 expect(ws.getValue(tr, '7')).toBe(0);
33 expect(ws.getValue(tr, '11')).toBe(2_000_000);
34 expect(ws.deductibleMortgateInterest(tr)).toBe(20_000);
37 test('pre-limitation debt', () => {
38 const p = Person.self('A');
39 const tr = new TaxReturn();
41 tr.addForm(new Form1040({
42 filingStatus: FilingStatus.MarriedFilingJoint,
44 tr.addForm(new Form1098({
47 mortgageInterestReceived: 20_000,
48 outstandingMortgagePrincipal: 2_000_000,
49 mortgageOriginationDate: new Date('2010-01-02'),
51 const ws = new MortgageInterestDeductionWorksheet();
54 expect(ws.getValue(tr, '1')).toBe(0);
55 expect(ws.getValue(tr, '2')).toBe(2_000_000);
56 expect(ws.getValue(tr, '5')).toBe(2_000_000);
57 expect(ws.getValue(tr, '7')).toBe(0);
58 expect(ws.getValue(tr, '11')).toBe(1_000_000);
59 expect(ws.getValue(tr, '14')).toBe(0.5);
60 expect(ws.getValue(tr, '15')).toBe(10_000);
61 expect(ws.deductibleMortgateInterest(tr)).toBe(10_000);
64 test('limited debt', () => {
65 const p = Person.self('A');
66 const tr = new TaxReturn();
68 tr.addForm(new Form1040({
69 filingStatus: FilingStatus.MarriedFilingJoint,
71 tr.addForm(new Form1098({
74 mortgageInterestReceived: 20_000,
75 outstandingMortgagePrincipal: 2_000_000,
76 mortgageOriginationDate: new Date('2020-01-02'),
78 const ws = new MortgageInterestDeductionWorksheet();
81 expect(ws.getValue(tr, '1')).toBe(0);
82 expect(ws.getValue(tr, '2')).toBe(0);
83 expect(ws.getValue(tr, '5')).toBe(0);
84 expect(ws.getValue(tr, '7')).toBe(2_000_000);
85 expect(ws.getValue(tr, '11')).toBe(750_000);
86 expect(ws.getValue(tr, '14')).toBe(0.375);
87 expect(ws.getValue(tr, '15')).toBe(7_500);
88 expect(ws.deductibleMortgateInterest(tr)).toBe(7_500);