Add Form 8959.
[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 Form8959 from './Form8959';
8 import FormW2 from './FormW2';
9
10 test('w2 wages', () => {
11 const pa = Person.self('A');
12 const pb = Person.spouse('B');
13 const tr = new TaxReturn(2019);
14 tr.addForm(new FormW2({ employer: 'AA', employee: pa, wages: 1000000.00, fedIncomeTax: 0 }));
15 tr.addForm(new FormW2({ employer: 'BB', employee: pb, wages: 36.32, fedIncomeTax: 0 }));
16 const f1040 = new Form1040({ filingStatus: FilingStatus.MarriedFilingJoint });
17 tr.addForm(f1040);
18 tr.addForm(new Schedule2);
19 tr.addForm(new Form8959);
20 expect(f1040.getValue(tr, '1')).toBe(1000036.32);
21 f1040.getValue(tr, '23');
22 });
23
24 test('interest income', () => {
25 const p = Person.self('A');
26 const tr = new TaxReturn(2019);
27 tr.addForm(new Form1099INT({
28 payer: 'Bank',
29 payee: p,
30 interest: 100,
31 taxExemptInterest: 0
32 }));
33 tr.addForm(new Form1099INT({
34 payer: 'Bank 2',
35 payee: p,
36 interest: 3.50,
37 taxExemptInterest: 95
38 }));
39
40 const f1040 = new Form1040();
41 tr.addForm(f1040);
42
43 expect(f1040.getValue(tr, '2a')).toBe(95);
44 expect(f1040.getValue(tr, '2b')).toBe(103.5);
45 });
46
47 test('dividend income', () => {
48 const p = Person.self('A');
49 const tr = new TaxReturn(2019);
50 const f1099div = new Form1099DIV({
51 payer: 'Brokerage',
52 payee: p,
53 ordinaryDividends: 100,
54 qualifiedDividends: 75,
55 totalCapitalGain: 100
56 });
57 tr.addForm(f1099div);
58 tr.addForm(f1099div);
59
60 const f1040 = new Form1040();
61 tr.addForm(f1040);
62
63 expect(f1040.getValue(tr, '3a')).toBe(75 * 2);
64 expect(f1040.getValue(tr, '3b')).toBe(200);
65 });