From ed6526a8008c7f30de9ca9927e08993579a6a532 Mon Sep 17 00:00:00 2001 From: Vito Albano Date: Tue, 16 Apr 2024 11:45:08 +0100 Subject: [PATCH] [affected:*][ci:force] - Fixed problem after rebase --- .../src/lib/common/services/upload.service.spec.ts | 6 ++++-- .../src/lib/dialogs/folder.dialog.spec.ts | 12 +++++++++--- .../infinite-select-scroll.directive.spec.ts | 10 ++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/content-services/src/lib/common/services/upload.service.spec.ts b/lib/content-services/src/lib/common/services/upload.service.spec.ts index 29c95d94376..b09edf23031 100644 --- a/lib/content-services/src/lib/common/services/upload.service.spec.ts +++ b/lib/content-services/src/lib/common/services/upload.service.spec.ts @@ -17,12 +17,13 @@ import { EventEmitter } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigModule, AppConfigService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { UploadService } from './upload.service'; import { RepositoryInfo } from '@alfresco/js-api'; import { BehaviorSubject } from 'rxjs'; import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { FileModel, FileUploadStatus } from '../../common/models/file.model'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; declare let jasmine: any; @@ -35,10 +36,11 @@ describe('UploadService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [AppConfigModule], + imports: [AppConfigModule, HttpClientTestingModule], providers: [ UploadService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, + { provide: AppConfigService, useClass: AppConfigServiceMock }, { provide: DiscoveryApiService, useValue: { diff --git a/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts b/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts index 1256de08200..44bf6b9a2a1 100644 --- a/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts +++ b/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts @@ -37,7 +37,7 @@ describe('FolderDialogComponent', () => { let createFolderSpy: jasmine.Spy; const updateNode$ = new BehaviorSubject(null); - const createFolderNode$ = new BehaviorSubject(null); + let createFolderNode$ = null; beforeEach(() => { TestBed.configureTestingModule({ @@ -48,6 +48,7 @@ describe('FolderDialogComponent', () => { fixture = TestBed.createComponent(FolderDialogComponent); component = fixture.componentInstance; nodesApi = TestBed.inject(NodesApiService); + createFolderNode$ = new BehaviorSubject(null); createFolderSpy = spyOn(nodesApi, 'createFolder').and.returnValue(createFolderNode$); updateNodeSpy = spyOn(nodesApi, 'updateNode').and.returnValue(updateNode$); @@ -273,8 +274,13 @@ describe('FolderDialogComponent', () => { }); describe('Error events', () => { + let errorSubscriber = null; + afterEach(() => { createFolderNode$.next(null); + if (errorSubscriber) { + errorSubscriber.complete(); + } }); it('should raise error for 409', (done) => { @@ -283,7 +289,7 @@ describe('FolderDialogComponent', () => { }; createFolderNode$.error(error); - component.error.subscribe((message) => { + errorSubscriber = component.error.subscribe((message) => { expect(message).toBe('CORE.MESSAGES.ERRORS.EXISTENT_FOLDER'); done(); }); @@ -300,7 +306,7 @@ describe('FolderDialogComponent', () => { }; createFolderNode$.error(error); - component.error.subscribe((message) => { + errorSubscriber = component.error.subscribe((message) => { expect(message).toBe('CORE.MESSAGES.ERRORS.GENERIC'); done(); }); diff --git a/lib/core/src/lib/directives/infinite-select-scroll.directive.spec.ts b/lib/core/src/lib/directives/infinite-select-scroll.directive.spec.ts index 3022f83da68..362de047e1e 100644 --- a/lib/core/src/lib/directives/infinite-select-scroll.directive.spec.ts +++ b/lib/core/src/lib/directives/infinite-select-scroll.directive.spec.ts @@ -53,14 +53,8 @@ describe('InfiniteSelectScrollDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - MatSelectModule, - NoopAnimationsModule - ], - declarations: [ - TestComponent, - InfiniteSelectScrollDirective - ] + imports: [MatSelectModule, NoopAnimationsModule, InfiniteSelectScrollDirective], + declarations: [TestComponent] }); fixture = TestBed.createComponent(TestComponent); component = fixture.componentInstance;