Add Form 1099-DIV.
[ustaxlib.git] / src / fed2019 / Form1040.test.ts
1 import Person from '../Person';
2 import TaxReturn from '../TaxReturn';
3
4 import Form1040, { FilingStatus } 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 expect(f1040.getValue(tr, '1')).toBe(1000036.32);
18 f1040.getValue(tr, '23');
19 });
20
21 test('interest income', () => {
22 const p = Person.self('A');
23 const tr = new TaxReturn(2019);
24 tr.addForm(new Form1099INT({
25 payer: 'Bank',
26 payee: p,
27 interest: 100,
28 taxExemptInterest: 0
29 }));
30 tr.addForm(new Form1099INT({
31 payer: 'Bank 2',
32 payee: p,
33 interest: 3.50,
34 taxExemptInterest: 95
35 }));
36
37 const f1040 = new Form1040();
38 tr.addForm(f1040);
39
40 expect(f1040.getValue(tr, '2a')).toBe(95);
41 expect(f1040.getValue(tr, '2b')).toBe(103.5);
42 });
43
44 test('dividend income', () => {
45 const p = Person.self('A');
46 const tr = new TaxReturn(2019);
47 const f1099div = new Form1099DIV({
48 payer: 'Brokerage',
49 payee: p,
50 ordinaryDividends: 100,
51 qualifiedDividends: 75,
52 totalCapitalGain: 100
53 });
54 tr.addForm(f1099div);
55 tr.addForm(f1099div);
56
57 const f1040 = new Form1040();
58 tr.addForm(f1040);
59
60 expect(f1040.getValue(tr, '3a')).toBe(75 * 2);
61 expect(f1040.getValue(tr, '3b')).toBe(200);
62 });