1 import Person from '../Person';
2 import TaxReturn from '../TaxReturn';
3 import { NotFoundError } from '../Errors';
5 import Form1040, { FilingStatus, Schedule2 } from './Form1040';
6 import Form1099DIV from './Form1099DIV';
7 import Form1099INT from './Form1099INT';
8 import Form1099B, { GainType } from './Form1099B';
9 import Form1099R, { Box7Code } from './Form1099R';
10 import ScheduleD, { ScheduleDTaxWorksheet } from './ScheduleD';
11 import Form8606 from './Form8606';
12 import Form8959 from './Form8959';
13 import Form8949 from './Form8949';
14 import FormW2 from './FormW2';
16 test('w2 wages', () => {
17 const pa = Person.self('A');
18 const pb = Person.spouse('B');
19 const tr = new TaxReturn(2019);
20 tr.addForm(new FormW2({
27 tr.addForm(new FormW2({
34 const f1040 = new Form1040({ filingStatus: FilingStatus.MarriedFilingJoint });
36 tr.addForm(new Schedule2);
37 expect(f1040.getValue(tr, '1')).toBe(130036.32);
38 f1040.getValue(tr, '23');
41 test('interest income', () => {
42 const p = Person.self('A');
43 const tr = new TaxReturn(2019);
44 tr.addForm(new Form1099INT({
50 tr.addForm(new Form1099INT({
57 const f1040 = new Form1040();
60 expect(f1040.getValue(tr, '2a')).toBe(95);
61 expect(f1040.getValue(tr, '2b')).toBe(103.5);
64 test('dividend income', () => {
65 const p = Person.self('A');
66 const tr = new TaxReturn(2019);
67 const f1099div = new Form1099DIV({
70 ordinaryDividends: 100,
71 qualifiedDividends: 75,
77 const f1040 = new Form1040();
80 expect(f1040.getValue(tr, '3a')).toBe(75 * 2);
81 expect(f1040.getValue(tr, '3b')).toBe(200);
84 test('capital gain/loss', () => {
85 const p = Person.self('A');
86 const tr = new TaxReturn(2019);
87 tr.addForm(new Form1040({ filingStatus: FilingStatus.Single }));
88 tr.addForm(new FormW2({
93 tr.addForm(new Form1099B({
96 description: '10 FNDC',
99 gainType: GainType.LongTerm,
100 basisReportedToIRS: true
102 tr.addForm(new Form8949);
103 tr.addForm(new ScheduleD());
104 tr.addForm(new ScheduleDTaxWorksheet());
105 tr.getForm(ScheduleD).getValue(tr, '21');
106 tr.getForm(Form1040).getValue(tr, '12a');
109 test('require Form8959', () => {
110 const p = Person.self('A');
111 const tr = new TaxReturn(2019);
112 tr.addForm(new FormW2({
117 const f1040 = new Form1040({
118 filingStatus: FilingStatus.MarriedFilingSeparate,
121 tr.addForm(new Schedule2);
123 expect(() => f1040.getValue(tr, '15')).toThrow(NotFoundError);
124 expect(() => f1040.getValue(tr, '15')).toThrow('Form8959');
125 expect(f1040.getValue(tr, '1')).toBe(400000);
126 expect(f1040.getValue(tr, '8b')).toBe(400000);
129 test('backdoor and megabackdoor roth', () => {
130 const p = Person.self('A');
131 const tr = new TaxReturn(2019);
132 tr.addForm(new Form1099R({
135 grossDistribution: 6000,
137 taxableAmountNotDetermined: true,
138 totalDistribution: true,
140 distributionCodes: [Box7Code._2],
143 tr.addForm(new Form1099R({
146 grossDistribution: 27500,
148 taxableAmountNotDetermined: false,
149 totalDistribution: false,
151 employeeContributionsOrDesignatedRothContributions: 27500,
152 distributionCodes: [Box7Code.G],
155 tr.addForm(new Form8606({
157 nondeductibleContributions: 6000,
158 traditionalIraBasis: 0,
159 distributionFromTradSepOrSimpleIraOrMadeRothConversion: true,
160 contributionsMadeInCurrentYear: 0,
161 distributionsFromAllTradSepSimpleIras: 0,
162 valueOfAllTradSepSimpleIras: 0,
163 amountConvertedFromTradSepSimpleToRoth: 6000
165 const f = new Form1040();
168 expect(f.getValue(tr, '4a')).toBe(6000);
169 expect(f.getValue(tr, '4b')).toBe(0);