Add Schedule 1.
[ustaxlib.git] / src / fed2019 / Schedule1.test.ts
1 import TaxReturn from '../TaxReturn';
2 import Person from '../Person';
3 import { UnsupportedFeatureError } from '../Errors';
4
5 import Form1040, { FilingStatus } from './Form1040';
6 import Schedule1, { Schedule1Input } from './Schedule1';
7
8 test('state tax refund', () => {
9 const p = Person.self('A');
10 const tr = new TaxReturn(2019);
11 tr.addForm(new Form1040({
12 filingStatus: FilingStatus.Single
13 }));
14 const f = new Schedule1({
15 stateAndLocalTaxableRefunds: 500
16 });
17 tr.addForm(f);
18
19 expect(f.getValue(tr, '9')).toBe(500);
20 expect(tr.getForm(Form1040).getValue(tr, '7a')).toBe(500);
21 });
22
23 test('unsupported inputs', () => {
24 const keys: (keyof Schedule1Input)[] = [
25 'businessIncome',
26 'otherGainsOrLosses',
27 'rentalRealEstateRoyaltiesPartnershipsSCorps',
28 'farmIncome',
29 'businessExpensesForm2106',
30 'hsaDeduction',
31 'armedForcesMovingExpenses',
32 'deductibleSelfEmploymentTax',
33 'tuitionAndFees',
34 ];
35 for (const input of keys) {
36 const p = Person.self('A');
37 const tr = new TaxReturn(2019);
38 const f = new Schedule1({
39 [input]: 100
40 });
41 tr.addForm(f);
42 expect(() => f.getValue(tr, '9') + f.getValue(tr, '22')).toThrow(UnsupportedFeatureError);
43 }
44 });