const f = new TestForm({ filingStatus: 'S', money: 100.0 });
expect(f.getInput('filingStatus')).toBe('S');
});
+
+test('get value', () => {
+ class TestForm extends Form {
+ get name() { return 'Form'; }
+
+ protected getLines() {
+ return [ new ComputedLine<number>('line', () => 42) ];
+ }
+ };
+
+ const f = new TestForm();
+ const tr = new TaxReturn(2019);
+ expect(f.getValue(tr, 'line')).toBe(42);
+});
+import TaxReturn from './TaxReturn';
import { Line } from './Line';
import { InconsistencyError, NotFoundError } from './Errors';
return lines[0];
}
+ getValue<T>(tr: TaxReturn, id: string): T {
+ const line: Line<T> = this.getLine(id);
+ return line.value(tr);
+ }
+
getInput<K extends keyof I>(name: K): I[K] {
if (!(name in this._input)) {
throw new NotFoundError(`No input with key ${name} on form ${this.name}`);