[ACS-9536] fix failing unit tests (#4556)

* [ACS-9536] fix failing unit tests, use correct testing module

* [ACS-9536] provide mock service for preview unit tests
This commit is contained in:
Grzegorz Jaśkowski 2025-05-12 10:06:21 +02:00 committed by GitHub
parent 311efee36d
commit 325d072c4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 14 deletions

View File

@ -491,6 +491,10 @@ describe('FilesComponent', () => {
documentBasePageService = TestBed.inject(DocumentBasePageService);
});
afterEach(() => {
store.resetSelectors();
});
it('should have assigned displayDragAndDropHint to false if currentFolder is selected and uploading is not allowable', () => {
store.overrideSelector(getCurrentFolder, node);
spyOn(documentBasePageService, 'canUploadContent').and.returnValue(false);

View File

@ -24,22 +24,15 @@
import { Router, ActivatedRoute } from '@angular/router';
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
import { AuthenticationService } from '@alfresco/adf-core';
import { UploadService, NodesApiService, DiscoveryApiService } from '@alfresco/adf-content-services';
import { UploadService, NodesApiService } from '@alfresco/adf-content-services';
import { ClosePreviewAction } from '@alfresco/aca-shared/store';
import { PreviewComponent } from './preview.component';
import { of, throwError } from 'rxjs';
import {
ContentApiService,
AppHookService,
DocumentBasePageService,
LibTestingModule,
discoveryApiServiceMockValue,
DocumentBasePageServiceMock
} from '@alfresco/aca-shared';
import { ContentApiService, AppHookService, DocumentBasePageService, DocumentBasePageServiceMock } from '@alfresco/aca-shared';
import { Store } from '@ngrx/store';
import { Node } from '@alfresco/js-api';
import { AcaViewerModule } from '../../viewer.module';
import { AppTestingModule } from '../../../../../src/lib/testing/app-testing.module';
const clickEvent = new MouseEvent('click');
@ -56,11 +49,12 @@ describe('PreviewComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [LibTestingModule, AcaViewerModule],
imports: [AppTestingModule, AcaViewerModule],
providers: [
{ provide: DocumentBasePageService, useValue: DocumentBasePageServiceMock },
{ provide: DiscoveryApiService, useValue: discoveryApiServiceMockValue },
{ provide: AuthenticationService, useValue: {} }
{
provide: DocumentBasePageService,
useClass: DocumentBasePageServiceMock
}
]
});