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';
9 import Form1040, { FilingStatus } from './Form1040';
10 import Form1099B from './Form1099B';
11 import Form1099DIV from './Form1099DIV';
12 import Form1099INT from './Form1099INT';
13 import Form8949 from './Form8949';
14 import Form8959 from './Form8959';
15 import Form8960 from './Form8960';
16 import Schedule2 from './Schedule2';
17 import ScheduleD from './ScheduleD';
18 import TaxReturn from './TaxReturn';
20 describe('net investment income tax', () => {
21 const filingStatusToResult = {
22 [FilingStatus.Single]: 105555,
23 [FilingStatus.MarriedFilingJoint]: 55555,
24 [FilingStatus.MarriedFilingSeparate]: 180555,
27 for (const filingStatus of Object.values(FilingStatus)) {
28 test(`filing status ${filingStatus}`, () => {
29 const p = Person.self('A');
30 const tr = new TaxReturn();
32 tr.addForm(new Form1040({ filingStatus }));
33 tr.addForm(new Form1099DIV({
36 ordinaryDividends: 2000,
37 qualifiedDividends: 1500,
40 tr.addForm(new Form1099INT({
45 tr.addForm(new Form1099B({
48 longTermBasisReported: [
50 description: '100 VTI',
56 tr.addForm(new Form8949);
57 tr.addForm(new ScheduleD);
66 tr.addForm(new Form8959);
67 tr.addForm(new Schedule2);
69 const f = new Form8960();
72 expect(f.getValue(tr, '1')).toBe(3000);
73 expect(f.getValue(tr, '2')).toBe(2000);
74 expect(f.getValue(tr, '5a')).toBe(555);
75 expect(f.getValue(tr, '8')).toBe(5555);
76 expect(f.getValue(tr, '11')).toBe(0);
77 expect(f.getValue(tr, '12')).toBe(5555);
78 expect(f.getValue(tr, '13')).toBe(305555);
79 expect(f.getValue(tr, '14')).toBe(Form8960.filingStatusLimit(tr));
80 expect(f.getValue(tr, '15')).toBe(filingStatusToResult[filingStatus]);
81 expect(f.getValue(tr, '16')).toBe(5555);
82 expect(f.getValue(tr, '17')).toBe(5555 * 0.038);
84 expect(tr.getForm(Schedule2).getValue(tr, '8')).toBe(5555 * 0.038);
89 describe('no net investment income tax', () => {
90 for (const filingStatus of Object.values(FilingStatus)) {
91 test(`filing status ${filingStatus}`, () => {
92 const p = Person.self('A');
93 const tr = new TaxReturn();
95 tr.addForm(new Form1040({ filingStatus }));
96 tr.addForm(new Form1099DIV({
99 ordinaryDividends: 2000,
100 qualifiedDividends: 1500,
103 tr.addForm(new Form1099INT({
108 tr.addForm(new Form1099B({
111 longTermBasisReported: [
113 description: '100 VTI',
119 tr.addForm(new Form8949);
120 tr.addForm(new ScheduleD);
129 tr.addForm(new Form8959);
130 tr.addForm(new Schedule2);
132 const f = new Form8960();
135 expect(f.getValue(tr, '17')).toBe(0);
136 expect(tr.getForm(Schedule2).getValue(tr, '8')).toBe(0);