Add support for Form 1098 and the mortgage interest deduction to Schedule A.
[ustaxlib.git] / src / fed2019 / Form1098.test.ts
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
5
6 import { Person } from '../core';
7
8 import Form1040, { FilingStatus } from './Form1040';
9 import { Form1098, MortgageInterestDeductionWorksheet } from './Form1098';
10 import TaxReturn from './TaxReturn';
11
12 test('grandfathered debt', () => {
13 const p = Person.self('A');
14 const tr = new TaxReturn();
15 tr.addPerson(p);
16 tr.addForm(new Form1040({
17 filingStatus: FilingStatus.MarriedFilingJoint,
18 }));
19 tr.addForm(new Form1098({
20 recipient: 'Bank',
21 payee: p,
22 mortgageInterestReceived: 20_000,
23 outstandingMortgagePrincipal: 2_000_000,
24 mortgageOriginationDate: new Date('1980-01-02'),
25 }));
26 const ws = new MortgageInterestDeductionWorksheet();
27 tr.addForm(ws);
28
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);
35 });
36
37 test('pre-limitation debt', () => {
38 const p = Person.self('A');
39 const tr = new TaxReturn();
40 tr.addPerson(p);
41 tr.addForm(new Form1040({
42 filingStatus: FilingStatus.MarriedFilingJoint,
43 }));
44 tr.addForm(new Form1098({
45 recipient: 'Bank',
46 payee: p,
47 mortgageInterestReceived: 20_000,
48 outstandingMortgagePrincipal: 2_000_000,
49 mortgageOriginationDate: new Date('2010-01-02'),
50 }));
51 const ws = new MortgageInterestDeductionWorksheet();
52 tr.addForm(ws);
53
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);
62 });
63
64 test('limited debt', () => {
65 const p = Person.self('A');
66 const tr = new TaxReturn();
67 tr.addPerson(p);
68 tr.addForm(new Form1040({
69 filingStatus: FilingStatus.MarriedFilingJoint,
70 }));
71 tr.addForm(new Form1098({
72 recipient: 'Bank',
73 payee: p,
74 mortgageInterestReceived: 20_000,
75 outstandingMortgagePrincipal: 2_000_000,
76 mortgageOriginationDate: new Date('2020-01-02'),
77 }));
78 const ws = new MortgageInterestDeductionWorksheet();
79 tr.addForm(ws);
80
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);
89 });