Implement the Schedule D Tax Worksheet.
[ustaxlib.git] / src / fed2019 / Form1040.test.ts
1 import Person from '../Person';
2 import TaxReturn from '../TaxReturn';
3
4 import Form1040, { FilingStatus, Schedule2 } from './Form1040';
5 import Form1099DIV from './Form1099DIV';
6 import Form1099INT from './Form1099INT';
7 import Form1099B, { GainType } from './Form1099B';
8 import ScheduleD, { ScheduleDTaxWorksheet } from './ScheduleD';
9 import Form8959 from './Form8959';
10 import Form8949 from './Form8949';
11 import FormW2 from './FormW2';
12
13 test('w2 wages', () => {
14 const pa = Person.self('A');
15 const pb = Person.spouse('B');
16 const tr = new TaxReturn(2019);
17 tr.addForm(new FormW2({
18 employer: 'AA',
19 employee: pa,
20 wages: 1000000.00,
21 fedIncomeTax: 0,
22 medicareWages: 0,
23 }));
24 tr.addForm(new FormW2({
25 employer: 'BB',
26 employee: pb,
27 wages: 36.32,
28 fedIncomeTax: 0,
29 medicareWages: 0,
30 }));
31 const f1040 = new Form1040({ filingStatus: FilingStatus.MarriedFilingJoint });
32 tr.addForm(f1040);
33 tr.addForm(new Schedule2);
34 tr.addForm(new Form8959);
35 expect(f1040.getValue(tr, '1')).toBe(1000036.32);
36 f1040.getValue(tr, '23');
37 });
38
39 test('interest income', () => {
40 const p = Person.self('A');
41 const tr = new TaxReturn(2019);
42 tr.addForm(new Form1099INT({
43 payer: 'Bank',
44 payee: p,
45 interest: 100,
46 taxExemptInterest: 0
47 }));
48 tr.addForm(new Form1099INT({
49 payer: 'Bank 2',
50 payee: p,
51 interest: 3.50,
52 taxExemptInterest: 95
53 }));
54
55 const f1040 = new Form1040();
56 tr.addForm(f1040);
57
58 expect(f1040.getValue(tr, '2a')).toBe(95);
59 expect(f1040.getValue(tr, '2b')).toBe(103.5);
60 });
61
62 test('dividend income', () => {
63 const p = Person.self('A');
64 const tr = new TaxReturn(2019);
65 const f1099div = new Form1099DIV({
66 payer: 'Brokerage',
67 payee: p,
68 ordinaryDividends: 100,
69 qualifiedDividends: 75,
70 totalCapitalGain: 100
71 });
72 tr.addForm(f1099div);
73 tr.addForm(f1099div);
74
75 const f1040 = new Form1040();
76 tr.addForm(f1040);
77
78 expect(f1040.getValue(tr, '3a')).toBe(75 * 2);
79 expect(f1040.getValue(tr, '3b')).toBe(200);
80 });
81
82 test('capital gain/loss', () => {
83 const p = Person.self('A');
84 const tr = new TaxReturn(2019);
85 tr.addForm(new Form1040({ filingStatus: FilingStatus.Single }));
86 tr.addForm(new FormW2({
87 employer: 'Money',
88 employee: p,
89 wages: 100000
90 }));
91 tr.addForm(new Form1099B({
92 payer: 'Brokerage',
93 payee: p,
94 description: '10 FNDC',
95 proceeds: 1000,
96 costBasis: 800,
97 gainType: GainType.LongTerm,
98 basisReportedToIRS: true
99 }));
100 tr.addForm(new Form8949);
101 tr.addForm(new ScheduleD());
102 tr.addForm(new ScheduleDTaxWorksheet());
103 tr.getForm(ScheduleD).getValue(tr, '21');
104 tr.getForm(Form1040).getValue(tr, '12a');
105 });