diff --git a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/pre-assessment-summary/pre-assessment-summary.component.spec.ts b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/pre-assessment-summary/pre-assessment-summary.component.spec.ts index a76bcec..b839088 100644 --- a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/pre-assessment-summary/pre-assessment-summary.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/pre-assessment-summary/pre-assessment-summary.component.spec.ts @@ -4,45 +4,17 @@ import { PreAssessmentSummaryComponent } from './pre-assessment-summary.componen import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module'; import { TableEntriesModule } from 'src/app/shared/table-entries/table-entries.module'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { BehaviorSubject } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit, getNewIdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { IdbContact } from 'src/app/models/contact'; +import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub'; describe('PreAssessmentSummaryComponent', () => { let component: PreAssessmentSummaryComponent; let fixture: ComponentFixture; - - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let assessmentIdbService: Partial = { - assessments: new BehaviorSubject>([]) - }; - let onSiteVisitIdbService: Partial = { - selectedVisit: new BehaviorSubject(getNewIdbOnSiteVisit('', '', '')) - }; - let contactIdbService: Partial = { - contacts: new BehaviorSubject>([]) - }; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ FontAwesomeModule, HelperPipesModule, TableEntriesModule], declarations: [PreAssessmentSummaryComponent], - providers: [ - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - { provide: ContactIdbService, useValue: contactIdbService } - - ] + providers: stubServiceProviders }) .compileComponents(); diff --git a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/process-equipment-summary/process-equipment-summary.component.spec.ts b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/process-equipment-summary/process-equipment-summary.component.spec.ts index f09916c..9573234 100644 --- a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/process-equipment-summary/process-equipment-summary.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/process-equipment-summary/process-equipment-summary.component.spec.ts @@ -3,31 +3,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ProcessEquipmentSummaryComponent } from './process-equipment-summary.component'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { IdbContact } from 'src/app/models/contact'; -import { ProcessEquipmentIdbService } from 'src/app/indexed-db/process-equipment-idb.service'; -import { IdbProcessEquipment } from 'src/app/models/processEquipment'; +import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub'; +import { TableEntriesModule } from 'src/app/shared/table-entries/table-entries.module'; describe('ProcessEquipmentSummaryComponent', () => { let component: ProcessEquipmentSummaryComponent; let fixture: ComponentFixture; - - let contactIdbService: Partial = { - contacts: new BehaviorSubject>([]) - }; - let processEquipmentIdbService: Partial = { - processEquipments: new BehaviorSubject>([]) - } beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, HelperPipesModule], + imports: [FontAwesomeModule, HelperPipesModule, TableEntriesModule], declarations: [ProcessEquipmentSummaryComponent], - providers: [ - { provide: ContactIdbService, useValue: contactIdbService }, - { provide: ProcessEquipmentIdbService, useValue: processEquipmentIdbService } - ] + providers: stubServiceProviders }) .compileComponents(); diff --git a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/review-pre-visit-setup.component.spec.ts b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/review-pre-visit-setup.component.spec.ts index 7fcf35d..9bb0df4 100644 --- a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/review-pre-visit-setup.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/review-pre-visit-setup.component.spec.ts @@ -2,15 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReviewPreVisitSetupComponent } from './review-pre-visit-setup.component'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { BehaviorSubject } from 'rxjs'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; import { TeamDetailsSummaryComponent } from './team-details-summary/team-details-summary.component'; import { ProcessEquipmentSummaryComponent } from './process-equipment-summary/process-equipment-summary.component'; import { PreAssessmentSummaryComponent } from './pre-assessment-summary/pre-assessment-summary.component'; @@ -18,60 +10,18 @@ import { FacilityDetailsSummaryComponent } from './facility-details-summary/faci import { CompanyKpisSummaryComponent } from './company-kpis-summary/company-kpis-summary.component'; import { CompanyDetailsSummaryComponent } from './company-details-summary/company-details-summary.component'; import { TableEntriesModule } from 'src/app/shared/table-entries/table-entries.module'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit, getNewIdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { IdbContact } from 'src/app/models/contact'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; -import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; -import { ProcessEquipmentIdbService } from 'src/app/indexed-db/process-equipment-idb.service'; -import { IdbProcessEquipment } from 'src/app/models/processEquipment'; +import { SystemInventorySummaryComponent } from './system-inventory-summary/system-inventory-summary.component'; +import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub'; describe('ReviewPreVisitSetupComponent', () => { let component: ReviewPreVisitSetupComponent; let fixture: ComponentFixture; - let setupWizardService: Partial = { - sidebarOpen: new BehaviorSubject(false), - }; - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let onSiteVisitIdbService: Partial = { - selectedVisit: new BehaviorSubject(getNewIdbOnSiteVisit('', '', '')) - }; - - let contactIdbService: Partial = { - contacts: new BehaviorSubject>([]) - }; - let assessmentIdbService: Partial = { - assessments: new BehaviorSubject>([]) - }; - let keyPerformanceIndicatorIdbService: Partial = { - keyPerformanceIndicators: new BehaviorSubject>([]) - }; - let processEquipmentIdbService: Partial = { - processEquipments: new BehaviorSubject>([]) - } beforeEach(async () => { await TestBed.configureTestingModule({ imports: [FontAwesomeModule, HelperPipesModule, TableEntriesModule], - declarations: [ReviewPreVisitSetupComponent, TeamDetailsSummaryComponent, ProcessEquipmentSummaryComponent, PreAssessmentSummaryComponent, FacilityDetailsSummaryComponent, CompanyKpisSummaryComponent, CompanyDetailsSummaryComponent], - providers: [ - { provide: SetupWizardService, useValue: setupWizardService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: ContactIdbService, useValue: contactIdbService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - { provide: KeyPerformanceIndicatorsIdbService, useValue: keyPerformanceIndicatorIdbService }, - { provide: ProcessEquipmentIdbService, useValue: processEquipmentIdbService } - ] + declarations: [ReviewPreVisitSetupComponent, TeamDetailsSummaryComponent, ProcessEquipmentSummaryComponent, PreAssessmentSummaryComponent, FacilityDetailsSummaryComponent, CompanyKpisSummaryComponent, CompanyDetailsSummaryComponent, SystemInventorySummaryComponent], + providers: stubServiceProviders }) .compileComponents(); diff --git a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/system-inventory-summary/system-inventory-summary.component.spec.ts b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/system-inventory-summary/system-inventory-summary.component.spec.ts index 6c842a2..33188c1 100644 --- a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/system-inventory-summary/system-inventory-summary.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/system-inventory-summary/system-inventory-summary.component.spec.ts @@ -1,6 +1,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SystemInventorySummaryComponent } from './system-inventory-summary.component'; +import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { TableEntriesModule } from 'src/app/shared/table-entries/table-entries.module'; +import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module'; describe('SystemInventorySummaryComponent', () => { let component: SystemInventorySummaryComponent; @@ -8,7 +12,9 @@ describe('SystemInventorySummaryComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [SystemInventorySummaryComponent] + imports: [FontAwesomeModule, HelperPipesModule, TableEntriesModule], + declarations: [SystemInventorySummaryComponent], + providers: stubServiceProviders }) .compileComponents(); diff --git a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/team-details-summary/team-details-summary.component.spec.ts b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/team-details-summary/team-details-summary.component.spec.ts index f98ce77..c738d88 100644 --- a/src/app/setup-wizard/pre-visit/review-pre-visit-setup/team-details-summary/team-details-summary.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/review-pre-visit-setup/team-details-summary/team-details-summary.component.spec.ts @@ -1,7 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TeamDetailsSummaryComponent } from './team-details-summary.component'; -import { ContactSummaryCardComponent } from './contact-summary-card/contact-summary-card.component'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module'; import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; @@ -24,7 +23,7 @@ describe('TeamDetailsSummaryComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ FontAwesomeModule, HelperPipesModule], - declarations: [TeamDetailsSummaryComponent, ContactSummaryCardComponent], + declarations: [TeamDetailsSummaryComponent], providers: [ { provide: ContactIdbService, useValue: contactIdbService }, { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService } diff --git a/src/app/spec-helpers/spec-test-service-stub.ts b/src/app/spec-helpers/spec-test-service-stub.ts index c8299bc..083a096 100644 --- a/src/app/spec-helpers/spec-test-service-stub.ts +++ b/src/app/spec-helpers/spec-test-service-stub.ts @@ -130,7 +130,8 @@ let stubProcessEquipment: IdbProcessEquipment = getNewIdbProcessEquipment('123', stubProcessEquipment.guid = '123'; let processEquipmentIdbService: Partial = { processEquipments: new BehaviorSubject>([stubProcessEquipment]), - getByGuid: () => { return stubProcessEquipment } + getByGuid: () => { return stubProcessEquipment }, + getFacilityProcessEquipment: () => { return [stubProcessEquipment] } } let stubKpiImpact: IdbKeyPerformanceMetricImpact = getNewIdbKeyPerformanceMetricImpact('123', '123', '123', '123', '123', 'TRIR', '123', '123', '123');