Skip to content

Commit

Permalink
all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
rmroot committed Nov 25, 2024
1 parent f623db3 commit 9de30b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<PreAssessmentSummaryComponent>;


let facilityIdbService: Partial<FacilityIdbService> = {
facilities: new BehaviorSubject<Array<IdbFacility>>([]),
selectedFacility: new BehaviorSubject<IdbFacility>(getNewIdbFacility('', ''))
};
let assessmentIdbService: Partial<AssessmentIdbService> = {
assessments: new BehaviorSubject<Array<IdbAssessment>>([])
};
let onSiteVisitIdbService: Partial<OnSiteVisitIdbService> = {
selectedVisit: new BehaviorSubject<IdbOnSiteVisit>(getNewIdbOnSiteVisit('', '', ''))
};
let contactIdbService: Partial<ContactIdbService> = {
contacts: new BehaviorSubject<Array<IdbContact>>([])
};
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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProcessEquipmentSummaryComponent>;

let contactIdbService: Partial<ContactIdbService> = {
contacts: new BehaviorSubject<Array<IdbContact>>([])
};
let processEquipmentIdbService: Partial<ProcessEquipmentIdbService> = {
processEquipments: new BehaviorSubject<Array<IdbProcessEquipment>>([])
}
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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,26 @@ 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';
import { FacilityDetailsSummaryComponent } from './facility-details-summary/facility-details-summary.component';
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<ReviewPreVisitSetupComponent>;

let setupWizardService: Partial<SetupWizardService> = {
sidebarOpen: new BehaviorSubject<boolean>(false),
};
let companyIdbService: Partial<CompanyIdbService> = {
companies: new BehaviorSubject<Array<IdbCompany>>([]),
selectedCompany: new BehaviorSubject<IdbCompany>(getNewIdbCompany(''))
};
let facilityIdbService: Partial<FacilityIdbService> = {
facilities: new BehaviorSubject<Array<IdbFacility>>([]),
selectedFacility: new BehaviorSubject<IdbFacility>(getNewIdbFacility('', ''))
};
let onSiteVisitIdbService: Partial<OnSiteVisitIdbService> = {
selectedVisit: new BehaviorSubject<IdbOnSiteVisit>(getNewIdbOnSiteVisit('', '', ''))
};

let contactIdbService: Partial<ContactIdbService> = {
contacts: new BehaviorSubject<Array<IdbContact>>([])
};
let assessmentIdbService: Partial<AssessmentIdbService> = {
assessments: new BehaviorSubject<Array<IdbAssessment>>([])
};
let keyPerformanceIndicatorIdbService: Partial<KeyPerformanceIndicatorsIdbService> = {
keyPerformanceIndicators: new BehaviorSubject<Array<IdbKeyPerformanceIndicator>>([])
};
let processEquipmentIdbService: Partial<ProcessEquipmentIdbService> = {
processEquipments: new BehaviorSubject<Array<IdbProcessEquipment>>([])
}
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();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
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;
let fixture: ComponentFixture<SystemInventorySummaryComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SystemInventorySummaryComponent]
imports: [FontAwesomeModule, HelperPipesModule, TableEntriesModule],
declarations: [SystemInventorySummaryComponent],
providers: stubServiceProviders
})
.compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 }
Expand Down
3 changes: 2 additions & 1 deletion src/app/spec-helpers/spec-test-service-stub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ let stubProcessEquipment: IdbProcessEquipment = getNewIdbProcessEquipment('123',
stubProcessEquipment.guid = '123';
let processEquipmentIdbService: Partial<ProcessEquipmentIdbService> = {
processEquipments: new BehaviorSubject<Array<IdbProcessEquipment>>([stubProcessEquipment]),
getByGuid: () => { return stubProcessEquipment }
getByGuid: () => { return stubProcessEquipment },
getFacilityProcessEquipment: () => { return [stubProcessEquipment] }
}

let stubKpiImpact: IdbKeyPerformanceMetricImpact = getNewIdbKeyPerformanceMetricImpact('123', '123', '123', '123', '123', 'TRIR', '123', '123', '123');
Expand Down

0 comments on commit 9de30b8

Please sign in to comment.