diff --git a/AMW_angular/io/src/app/deployment/deployment.component.spec.ts b/AMW_angular/io/src/app/deployment/deployment.component.spec.ts index 4d71b75c3..551447f14 100644 --- a/AMW_angular/io/src/app/deployment/deployment.component.spec.ts +++ b/AMW_angular/io/src/app/deployment/deployment.component.spec.ts @@ -36,6 +36,7 @@ describe('DeploymentComponent (create deployment)', () => { let deploymentService: DeploymentService; beforeEach(() => { TestBed.configureTestingModule({ + teardown: { destroyAfterEach: false }, imports: [FormsModule, RouterTestingModule, DeploymentComponent, DummyComponent], providers: [ ResourceService, diff --git a/AMW_angular/io/src/app/deployments/deployments.component.spec.ts b/AMW_angular/io/src/app/deployments/deployments.component.spec.ts index 97daf5137..f1d566cb6 100644 --- a/AMW_angular/io/src/app/deployments/deployments.component.spec.ts +++ b/AMW_angular/io/src/app/deployments/deployments.component.spec.ts @@ -34,14 +34,26 @@ describe('DeploymentsComponent (with query params)', () => { let deploymentService: DeploymentService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormsModule, + teardown: { destroyAfterEach: false }, + imports: [ + FormsModule, RouterTestingModule.withRoutes([]), DeploymentsComponent, DeploymentsListComponent, PaginationComponent, - DeploymentsEditModalComponent], - providers: [DeploymentService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] -}).compileComponents(); + DeploymentsEditModalComponent, + ], + providers: [ + DeploymentService, + ResourceService, + { + provide: ActivatedRoute, + useValue: mockRoute, + }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); fixture = TestBed.createComponent(DeploymentsComponent); component = fixture.componentInstance; @@ -176,14 +188,25 @@ describe('DeploymentsComponent (with illegal query params)', () => { let deploymentService: DeploymentService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormsModule, + imports: [ + FormsModule, RouterTestingModule.withRoutes([]), DeploymentsComponent, DeploymentsListComponent, PaginationComponent, - DeploymentsEditModalComponent], - providers: [DeploymentService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] -}).compileComponents(); + DeploymentsEditModalComponent, + ], + providers: [ + DeploymentService, + ResourceService, + { + provide: ActivatedRoute, + useValue: mockRoute, + }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); fixture = TestBed.createComponent(DeploymentsComponent); component = fixture.componentInstance; @@ -226,14 +249,25 @@ describe('DeploymentsComponent (without query params)', () => { let resourceService: ResourceService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormsModule, + imports: [ + FormsModule, RouterTestingModule.withRoutes([]), DeploymentsComponent, DeploymentsListComponent, PaginationComponent, - DeploymentsEditModalComponent], - providers: [DeploymentService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] -}).compileComponents(); + DeploymentsEditModalComponent, + ], + providers: [ + DeploymentService, + ResourceService, + { + provide: ActivatedRoute, + useValue: mockRoute, + }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); fixture = TestBed.createComponent(DeploymentsComponent); component = fixture.componentInstance; diff --git a/AMW_angular/io/src/app/settings/permission/permission.component.spec.ts b/AMW_angular/io/src/app/settings/permission/permission.component.spec.ts index f28d39bfb..7862370e4 100644 --- a/AMW_angular/io/src/app/settings/permission/permission.component.spec.ts +++ b/AMW_angular/io/src/app/settings/permission/permission.component.spec.ts @@ -34,24 +34,27 @@ describe('PermissionComponent without any params (default: type Role)', () => { beforeEach(() => { TestBed.configureTestingModule({ - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [CommonModule, + teardown: { destroyAfterEach: false }, + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [ + CommonModule, FormsModule, RouterTestingModule.withRoutes([]), NgbModule, PermissionComponent, RestrictionEditComponent, RestrictionAddComponent, - RestrictionListComponent], - providers: [ + RestrictionListComponent, + ], + providers: [ EnvironmentService, PermissionService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), - ] -}); + ], + }); fixture = TestBed.createComponent(PermissionComponent); component = fixture.componentInstance; @@ -406,24 +409,26 @@ describe('PermissionComponent with param restrictionType (type User)', () => { beforeEach(() => { TestBed.configureTestingModule({ - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [CommonModule, + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [ + CommonModule, FormsModule, RouterTestingModule.withRoutes([]), NgbModule, PermissionComponent, RestrictionEditComponent, RestrictionAddComponent, - RestrictionListComponent], - providers: [ + RestrictionListComponent, + ], + providers: [ EnvironmentService, PermissionService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), - ] -}); + ], + }); fixture = TestBed.createComponent(PermissionComponent); component = fixture.componentInstance; fixture.detectChanges(); @@ -504,24 +509,26 @@ describe('PermissionComponent with param actingUser (delegation mode)', () => { beforeEach(() => { TestBed.configureTestingModule({ - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [CommonModule, + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [ + CommonModule, FormsModule, RouterTestingModule.withRoutes([]), NgbModule, PermissionComponent, RestrictionEditComponent, RestrictionAddComponent, - RestrictionListComponent], - providers: [ + RestrictionListComponent, + ], + providers: [ EnvironmentService, PermissionService, ResourceService, { provide: ActivatedRoute, useValue: mockRoute }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), - ] -}); + ], + }); fixture = TestBed.createComponent(PermissionComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/AMW_angular/io/src/test.ts b/AMW_angular/io/src/test.ts index b4bc56d99..c0b1a905e 100644 --- a/AMW_angular/io/src/test.ts +++ b/AMW_angular/io/src/test.ts @@ -1,4 +1,4 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files +// This file loads recursively all the .spec and framework files import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing';