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 ScheduleD, { ScheduleDTaxWorksheet } from './ScheduleD';
10 import Form8959 from './Form8959';
11 import Form8949 from './Form8949';
12 import FormW2 from './FormW2';
14 test('w2 wages', () => {
15 const pa = Person.self('A');
16 const pb = Person.spouse('B');
17 const tr = new TaxReturn(2019);
18 tr.addForm(new FormW2({
25 tr.addForm(new FormW2({
32 const f1040 = new Form1040({ filingStatus: FilingStatus.MarriedFilingJoint });
34 tr.addForm(new Schedule2);
35 expect(f1040.getValue(tr, '1')).toBe(130036.32);
36 f1040.getValue(tr, '23');
39 test('interest income', () => {
40 const p = Person.self('A');
41 const tr = new TaxReturn(2019);
42 tr.addForm(new Form1099INT({
48 tr.addForm(new Form1099INT({
55 const f1040 = new Form1040();
58 expect(f1040.getValue(tr, '2a')).toBe(95);
59 expect(f1040.getValue(tr, '2b')).toBe(103.5);
62 test('dividend income', () => {
63 const p = Person.self('A');
64 const tr = new TaxReturn(2019);
65 const f1099div = new Form1099DIV({
68 ordinaryDividends: 100,
69 qualifiedDividends: 75,
75 const f1040 = new Form1040();
78 expect(f1040.getValue(tr, '3a')).toBe(75 * 2);
79 expect(f1040.getValue(tr, '3b')).toBe(200);
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({
91 tr.addForm(new Form1099B({
94 description: '10 FNDC',
97 gainType: GainType.LongTerm,
98 basisReportedToIRS: true
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');
107 test('require Form8959', () => {
108 const p = Person.self('A');
109 const tr = new TaxReturn(2019);
110 tr.addForm(new FormW2({
115 const f1040 = new Form1040({
116 filingStatus: FilingStatus.MarriedFilingSeparate,
119 tr.addForm(new Schedule2);
121 expect(() => f1040.getValue(tr, '15')).toThrow(NotFoundError);
122 expect(() => f1040.getValue(tr, '15')).toThrow('Form8959');
123 expect(f1040.getValue(tr, '1')).toBe(400000);
124 expect(f1040.getValue(tr, '8b')).toBe(400000);