From 957d50b7b288dae581344875628c7fef00fa1ab4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 13 Mar 2020 00:15:52 -0400 Subject: [PATCH] Remove type test code for TaxReturn. --- src/core/TaxReturn.test.ts | 52 -------------------------------------- 1 file changed, 52 deletions(-) diff --git a/src/core/TaxReturn.test.ts b/src/core/TaxReturn.test.ts index 6adc7c6..9a5b252 100644 --- a/src/core/TaxReturn.test.ts +++ b/src/core/TaxReturn.test.ts @@ -100,55 +100,3 @@ test('get non-existent form', () => { expect(tr.findForm(TestForm)).toBeNull(); expect(tr.findForms(TestForm)).toEqual([]); }); - -type FormClass> = Function & { prototype: T }; - -class TR { - private _forms: Form[] = []; - - add(form: Form) { - this._forms.push(form); - } - - find(name: string): Form { - const forms = this._forms.filter(f => f.name == name); - if (forms.length > 0) - return forms[0]; - return null; - } - - find2>(cls: FormClass): T[] { - let forms: T[] = []; - const isT = (form: Form): form is T => form.constructor === cls; - for (let form of this._forms) { - if (isT(form)) - forms.push(form); - } - return forms; - } -}; - -test('type test', () => { - class FormA extends Form { - readonly name = 'Form A'; - protected readonly _lines = {}; - }; - class FormB extends Form { - readonly name = 'Form B'; - readonly supportsMultipleCopies = true; - protected readonly _lines = {}; - }; - - const tr = new TR(); - - tr.add(new FormA()); - tr.add(new FormB()); - - expect(tr.find('Form A')).not.toBeNull(); - - expect(tr.find2(FormB).length).toBe(1); - - tr.add(new FormB()); - expect(tr.find2(FormB).length).toBe(2); - -}); -- 2.22.5