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