LP1830973 Angular 8 org family test spec repair user/berick/lp1830973-ang8-test-spec-repair
authorBill Erickson <berickxx@gmail.com>
Tue, 22 Oct 2019 17:52:56 +0000 (13:52 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 28 Oct 2019 14:35:27 +0000 (10:35 -0400)
The test runner does not like that the test expectations are wrapped in
the fixture.whenStable promise.  It reports an error, since no
expectations occur in line with the test:

ERROR: 'Spec 'Component: OrgFamilySelect allows user to turn off
includeDescendants checkbox' has no expectations.'

As the whenStable checks do not appear to be necessary, simply removing
them resolves the issue and allows the tests to succeed.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.spec.ts

index f93b386..f389e7a 100644 (file)
@@ -64,51 +64,39 @@ describe('Component: OrgFamilySelect', () => {
 
 
     it('provides includeAncestors checkbox by default', () => {
-        fixture.whenStable().then(() => {
-            includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
-            expect(includeAncestors.nativeElement).toBeTruthy();
-        });
+        includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
+        expect(includeAncestors.nativeElement).toBeTruthy();
     });
 
     it('provides includeDescendants checkbox by default', () => {
-        fixture.whenStable().then(() => {
-            includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
-            expect(includeDescendants.nativeElement).toBeTruthy();
-        });
+        includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
+        expect(includeDescendants.nativeElement).toBeTruthy();
     });
 
     it('allows user to turn off includeAncestors checkbox', () => {
-        fixture.whenStable().then(() => {
-            component.hideAncestorSelector = true;
-            fixture.detectChanges();
-            includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
-            expect(includeAncestors).toBeNull();
-        });
+        component.hideAncestorSelector = true;
+        fixture.detectChanges();
+        includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
+        expect(includeAncestors).toBeNull();
     });
 
     it('allows user to turn off includeDescendants checkbox', () => {
-        fixture.whenStable().then(() => {
-            component.hideDescendantSelector = true;
-            fixture.detectChanges();
-            includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
-            expect(includeDescendants).toBeNull();
-        });
+        component.hideDescendantSelector = true;
+        fixture.detectChanges();
+        includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
+        expect(includeDescendants).toBeNull();
     });
 
     it('disables includeAncestors checkbox when root OU is chosen', () => {
-        fixture.whenStable().then(() => {
-            fixture.detectChanges();
-            includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
-            expect(includeAncestors.nativeElement.disabled).toBe(true);
-        });
+        fixture.detectChanges();
+        includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));
+        expect(includeAncestors.nativeElement.disabled).toBe(true);
     });
 
     it('disables includeAncestors checkbox when OU has no children', () => {
-        fixture.whenStable().then(() => {
-            fixture.detectChanges();
-            includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
-            expect(includeDescendants.nativeElement.disabled).toBe(true);
-        });
+        fixture.detectChanges();
+        includeDescendants = fixture.debugElement.query(By.css('#family-test-include-descendants'));
+        expect(includeDescendants.nativeElement.disabled).toBe(true);
     });
 
 });