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 addLines() {
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 addLines() {
33 const f = new TestForm();
34 expect(() => f.getLine('1')).toThrow(NotFoundError);
37 test('add duplicate line', () => {
38 const l1 = new ComputedLine<number>('1', () => 42);
39 const l2 = new ComputedLine<number>('1', () => 36);
41 class TestForm extends Form {
46 protected addLines() {
52 expect(() => new TestForm()).toThrow(InconsistencyError);