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
6 import { Person } from '../core';
7 import { UnsupportedFeatureError } from '../core/Errors';
9 import Form1040, { FilingStatus } from './Form1040';
10 import Schedule1, { Schedule1Input, SALTWorksheet } from './Schedule1';
11 import TaxReturn from './TaxReturn';
13 test('non-taxable state tax refund', () => {
14 const p = Person.self('A');
15 const tr = new TaxReturn();
16 tr.addForm(new Form1040({
17 filingStatus: FilingStatus.Single
19 const w = new SALTWorksheet({
21 limitedPrevYearSalt: 10000,
22 prevYearItemizedDeductions: 25000,
23 prevYearFilingStatus: FilingStatus.Single
26 const f = new Schedule1({
27 stateAndLocalTaxableRefunds: 17000
31 expect(w.getValue(tr, '1')).toBe(17000);
32 expect(w.getValue(tr, '2')).toStrictEqual([80000, true]);
33 expect(w.getValue(tr, '3')).toBe(0);
34 expect(w.getValue(tr, '9')).toBe(0);
35 expect(tr.getForm(Form1040).getValue(tr, '7a')).toBe(0);
38 test('taxable state tax refund', () => {
39 const p = Person.self('A');
40 const tr = new TaxReturn();
41 tr.addForm(new Form1040({
42 filingStatus: FilingStatus.Single
44 const w = new SALTWorksheet({
46 limitedPrevYearSalt: 7500,
47 prevYearItemizedDeductions: 14000,
48 prevYearFilingStatus: FilingStatus.Single
51 const f = new Schedule1({
52 stateAndLocalTaxableRefunds: 2000
56 expect(w.getValue(tr, '1')).toBe(2000);
57 expect(w.getValue(tr, '2')).toStrictEqual([2000, false]);
58 expect(w.getValue(tr, '3')).toBe(2000);
59 expect(w.getValue(tr, '9')).toBe(2000);
60 expect(tr.getForm(Form1040).getValue(tr, '7a')).toBe(2000);
63 test('unsupported inputs', () => {
64 const keys: (keyof Schedule1Input)[] = [
67 'rentalRealEstateRoyaltiesPartnershipsSCorps',
69 'businessExpensesForm2106',
71 'armedForcesMovingExpenses',
72 'deductibleSelfEmploymentTax',
75 for (const input of keys) {
76 const p = Person.self('A');
77 const tr = new TaxReturn();
78 const f = new Schedule1({
82 expect(() => f.getValue(tr, '9') + f.getValue(tr, '22')).toThrow(UnsupportedFeatureError);