Remove type test code for TaxReturn.
authorRobert Sesek <rsesek@bluestatic.org>
Fri, 13 Mar 2020 04:15:52 +0000 (00:15 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Fri, 13 Mar 2020 04:15:52 +0000 (00:15 -0400)
src/core/TaxReturn.test.ts

index 6adc7c64fc39dc3671336c34c4b7a1201623a96e..9a5b252e6e8f52b0dda848c3b6fdcf0a9e81e854 100644 (file)
@@ -100,55 +100,3 @@ test('get non-existent form', () => {
   expect(tr.findForm(TestForm)).toBeNull();
   expect(tr.findForms(TestForm)).toEqual([]);
 });
-
-type FormClass<T extends Form<any>> = Function & { prototype: T };
-
-class TR {
-  private _forms: Form<any>[] = [];
-
-  add(form: Form<any>) {
-    this._forms.push(form);
-  }
-
-  find(name: string): Form<any> {
-    const forms = this._forms.filter(f => f.name == name);
-    if (forms.length > 0)
-      return forms[0];
-    return null;
-  }
-
-  find2<T extends Form<any>>(cls: FormClass<T>): T[] {
-    let forms: T[] = [];
-    const isT = (form: Form<any>): 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<FormA['_lines']> {
-    readonly name = 'Form A';
-    protected readonly _lines = {};
-  };
-  class FormB extends Form<FormB['_lines']> {
-    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);
-
-});