From 00854e37785858c0b187ee6f74f6ceeb7792f46d Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Wed, 3 Jul 2019 09:46:04 -0700 Subject: [PATCH] LP1830432: Make sure that unit tests have an org unit selected Signed-off-by: Jane Sandberg Signed-off-by: Bill Erickson --- .../org-family-select.component.spec.ts | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.spec.ts b/Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.spec.ts index 3e7117c..f93b386 100644 --- a/Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.spec.ts +++ b/Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.spec.ts @@ -26,9 +26,8 @@ describe('Component: OrgFamilySelect', () => { beforeEach(() => { // stub of OrgService for testing - // with a very simple org structure: - // 1 is the root note - // 2 is its child + // with a super simple org structure: + // 1 is the root note, with no children orgServiceStub = { root: () => { return { @@ -42,7 +41,7 @@ describe('Component: OrgFamilySelect', () => { a: [], classname: 'aou', _isfieldmapper: true, - children: () => Array(2 - ouId) }; + children: () => Array() }; } }; cookieServiceStub = {}; @@ -59,6 +58,7 @@ describe('Component: OrgFamilySelect', () => { fixture = TestBed.createComponent(OrgFamilySelectComponent); component = fixture.componentInstance; component.domId = 'family-test'; + component.selectedOrgId = 1; fixture.detectChanges(); }); @@ -97,12 +97,19 @@ describe('Component: OrgFamilySelect', () => { it('disables includeAncestors checkbox when root OU is chosen', () => { fixture.whenStable().then(() => { - component.selectedOrgId = 1; 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); + }); + }); + }); -- 1.7.2.5