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