From fd0ec9546b4c8d90407b833eb075131e78dedc2a Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Thu, 18 Jul 2024 11:10:04 -0600 Subject: [PATCH] add providers for unit tests --- .../components/content/content.component.spec.ts | 5 +++-- .../control-panel/control-panel.component.spec.ts | 9 +++++++-- .../components/content/content.component.spec.ts | 5 +++-- .../control-panel/control-panel.component.spec.ts | 9 +++++++-- .../components/content/content.component.spec.ts | 7 +------ .../components/form/form.component.spec.ts | 4 ++-- .../job-submitted/job-submitted.component.spec.ts | 3 +-- .../components/content/content.component.spec.ts | 10 ++++++++-- 8 files changed, 32 insertions(+), 20 deletions(-) diff --git a/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/content/content.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/content/content.component.spec.ts index 7444cfab9..cca673d17 100644 --- a/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/content/content.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/content/content.component.spec.ts @@ -1,5 +1,6 @@ +import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideRouter} from '@angular/router'; import {ContentComponent} from './content.component'; @@ -10,7 +11,7 @@ describe('ContentComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ContentComponent], - providers: [provideMockStore({initialState: {}})], + providers: [provideHttpClient(), provideRouter([])], teardown: {destroyAfterEach: false}, }).compileComponents(); })); diff --git a/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/control-panel/control-panel.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/control-panel/control-panel.component.spec.ts index dd4d4d086..fc3aabef9 100644 --- a/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/control-panel/control-panel.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/check-haz-jobs/components/control-panel/control-panel.component.spec.ts @@ -1,6 +1,7 @@ import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideNoopAnimations} from '@angular/platform-browser/animations'; +import {provideRouter} from '@angular/router'; import {ControlPanelComponent} from './control-panel.component'; @@ -11,7 +12,11 @@ describe('ControlPanelComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ControlPanelComponent], - providers: [provideMockStore({initialState: {}}), provideHttpClient()], + providers: [ + provideHttpClient(), + provideRouter([]), + provideNoopAnimations(), + ], teardown: {destroyAfterEach: false}, }).compileComponents(); })); diff --git a/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/content/content.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/content/content.component.spec.ts index a988e21b6..1f327e4ee 100644 --- a/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/content/content.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/content/content.component.spec.ts @@ -1,5 +1,6 @@ +import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideRouter} from '@angular/router'; import {ContentComponent} from './content.component'; @@ -10,7 +11,7 @@ describe('ContentComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ContentComponent], - providers: [provideMockStore({initialState: {}})], + providers: [provideHttpClient(), provideRouter([])], teardown: {destroyAfterEach: false}, }).compileComponents(); }); diff --git a/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/control-panel/control-panel.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/control-panel/control-panel.component.spec.ts index c230c9b11..2a47ba536 100644 --- a/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/control-panel/control-panel.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/haz-job-history/components/control-panel/control-panel.component.spec.ts @@ -1,6 +1,7 @@ import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideNoopAnimations} from '@angular/platform-browser/animations'; +import {provideRouter} from '@angular/router'; import {ControlPanelComponent} from './control-panel.component'; @@ -11,7 +12,11 @@ describe('ControlPanelComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ControlPanelComponent], - providers: [provideMockStore({initialState: {}}), provideHttpClient()], + providers: [ + provideHttpClient(), + provideRouter([]), + provideNoopAnimations(), + ], teardown: {destroyAfterEach: false}, }).compileComponents(); }); diff --git a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/content/content.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/content/content.component.spec.ts index ec44eb9b6..c40c22d65 100644 --- a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/content/content.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/content/content.component.spec.ts @@ -1,7 +1,6 @@ import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; import {provideNoopAnimations} from '@angular/platform-browser/animations'; -import {provideMockStore} from '@ngrx/store/testing'; import {ContentComponent} from './content.component'; @@ -12,11 +11,7 @@ describe('ContentComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ContentComponent], - providers: [ - provideMockStore({initialState: {}}), - provideHttpClient(), - provideNoopAnimations(), - ], + providers: [provideHttpClient(), provideNoopAnimations()], teardown: {destroyAfterEach: false}, }).compileComponents(); })); diff --git a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/form/form.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/form/form.component.spec.ts index 269076542..54b45a13b 100644 --- a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/form/form.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/form/form.component.spec.ts @@ -1,6 +1,6 @@ import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideNoopAnimations} from '@angular/platform-browser/animations'; import {FormComponent} from './form.component'; @@ -11,7 +11,7 @@ describe('FormComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [FormComponent], - providers: [provideMockStore({initialState: {}}), provideHttpClient()], + providers: [provideHttpClient(), provideNoopAnimations()], teardown: {destroyAfterEach: false}, }).compileComponents(); }); diff --git a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.spec.ts index af575b0e4..3d4622fdf 100644 --- a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.spec.ts @@ -1,6 +1,5 @@ import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; import {JobSubmittedComponent} from './job-submitted.component'; @@ -11,7 +10,7 @@ describe('JobSubmittedComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [JobSubmittedComponent], - providers: [provideMockStore({initialState: {}}), provideHttpClient()], + providers: [provideHttpClient()], teardown: {destroyAfterEach: false}, }).compileComponents(); })); diff --git a/projects/nshmp-apps/src/app/dev/aws/terminate-haz-jobs/components/content/content.component.spec.ts b/projects/nshmp-apps/src/app/dev/aws/terminate-haz-jobs/components/content/content.component.spec.ts index a988e21b6..02cab8282 100644 --- a/projects/nshmp-apps/src/app/dev/aws/terminate-haz-jobs/components/content/content.component.spec.ts +++ b/projects/nshmp-apps/src/app/dev/aws/terminate-haz-jobs/components/content/content.component.spec.ts @@ -1,5 +1,7 @@ +import {provideHttpClient} from '@angular/common/http'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {provideMockStore} from '@ngrx/store/testing'; +import {provideNoopAnimations} from '@angular/platform-browser/animations'; +import {provideRouter} from '@angular/router'; import {ContentComponent} from './content.component'; @@ -10,7 +12,11 @@ describe('ContentComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ContentComponent], - providers: [provideMockStore({initialState: {}})], + providers: [ + provideHttpClient(), + provideRouter([]), + provideNoopAnimations(), + ], teardown: {destroyAfterEach: false}, }).compileComponents(); }); -- GitLab