1 import { ComputedLine, Line } from './Line';
2 import TaxReturn from './TaxReturn';
3 import Form from './Form';
4 import { InconsistencyError, NotFoundError } from './Errors';
6 test('add and get line', () => {
7 const l = new ComputedLine<number>('1', () => 42);
9 class TestForm extends Form {
14 protected getLines() {
19 const f = new TestForm();
20 expect(f.getLine('1')).toBe(l);
23 test('get non-existent line', () => {
24 class TestForm extends Form {
29 protected getLines() {
34 const f = new TestForm();
35 expect(() => f.getLine('1')).toThrow(NotFoundError);
38 test('add duplicate line', () => {
39 const l1 = new ComputedLine<number>('1', () => 42);
40 const l2 = new ComputedLine<number>('1', () => 36);
42 class TestForm extends Form {
47 protected getLines() {
52 expect(() => new TestForm()).toThrow(InconsistencyError);