Add license information.
[ustaxlib.git] / src / fed2019 / Schedule1.test.ts
1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
5
6 import { Person } from '../core';
7 import { UnsupportedFeatureError } from '../core/Errors';
8
9 import Form1040, { FilingStatus } from './Form1040';
10 import Schedule1, { Schedule1Input } from './Schedule1';
11 import TaxReturn from './TaxReturn';
12
13 test('state tax refund', () => {
14 const p = Person.self('A');
15 const tr = new TaxReturn();
16 tr.addForm(new Form1040({
17 filingStatus: FilingStatus.Single
18 }));
19 const f = new Schedule1({
20 stateAndLocalTaxableRefunds: 500
21 });
22 tr.addForm(f);
23
24 expect(f.getValue(tr, '9')).toBe(500);
25 expect(tr.getForm(Form1040).getValue(tr, '7a')).toBe(500);
26 });
27
28 test('unsupported inputs', () => {
29 const keys: (keyof Schedule1Input)[] = [
30 'businessIncome',
31 'otherGainsOrLosses',
32 'rentalRealEstateRoyaltiesPartnershipsSCorps',
33 'farmIncome',
34 'businessExpensesForm2106',
35 'hsaDeduction',
36 'armedForcesMovingExpenses',
37 'deductibleSelfEmploymentTax',
38 'tuitionAndFees',
39 ];
40 for (const input of keys) {
41 const p = Person.self('A');
42 const tr = new TaxReturn();
43 const f = new Schedule1({
44 [input]: 100
45 });
46 tr.addForm(f);
47 expect(() => f.getValue(tr, '9') + f.getValue(tr, '22')).toThrow(UnsupportedFeatureError);
48 }
49 });