AAE-37293 switch to provider api (#4735)

This commit is contained in:
Denys Vuika
2025-08-08 08:58:59 -04:00
committed by GitHub
parent 38fd3547eb
commit 0b6604a43e
14 changed files with 61 additions and 154 deletions
@@ -25,14 +25,14 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageComponent } from './document-base-page.component';
import { AppState, SetSelectedNodesAction, ViewNodeAction } from '@alfresco/aca-shared/store';
import { AppExtensionService, LibTestingModule, discoveryApiServiceMockValue, DocumentBasePageServiceMock } from '@alfresco/aca-shared';
import { LibTestingModule, discoveryApiServiceMockValue, DocumentBasePageServiceMock } from '@alfresco/aca-shared';
import { NodeEntry, NodePaging } from '@alfresco/js-api';
import { DocumentBasePageService } from './document-base-page.service';
import { Store } from '@ngrx/store';
import { Component } from '@angular/core';
import { DiscoveryApiService, DocumentListComponent, DocumentListService, SearchAiInputState, SearchAiService } from '@alfresco/adf-content-services';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { AuthModule, UserPreferencesService } from '@alfresco/adf-core';
import { provideCoreAuth, UserPreferencesService } from '@alfresco/adf-core';
import { of, Subscription } from 'rxjs';
import { MatDialogModule } from '@angular/material/dialog';
import { NavigationHistoryService } from '../../services/navigation-history.service';
@@ -76,12 +76,12 @@ describe('PageComponent', () => {
searchAiService.toggleSearchAiInput$ = of({ active: false });
TestBed.configureTestingModule({
imports: [LibTestingModule, AuthModule.forRoot(), MatDialogModule],
imports: [LibTestingModule, MatDialogModule],
declarations: [TestComponent],
providers: [
provideCoreAuth(),
{ provide: DocumentBasePageService, useClass: DocumentBasePageServiceMock },
{ provide: DiscoveryApiService, useValue: discoveryApiServiceMockValue },
AppExtensionService,
{
provide: UserPreferencesService,
useValue: userPreferencesService
@@ -318,11 +318,11 @@ describe('Info Drawer state', () => {
};
TestBed.configureTestingModule({
imports: [LibTestingModule, AuthModule.forRoot(), MatDialogModule],
imports: [LibTestingModule, MatDialogModule],
declarations: [TestComponent],
providers: [
provideCoreAuth(),
{ provide: DocumentBasePageService, useClass: DocumentBasePageServiceMock },
AppExtensionService,
{ provide: DiscoveryApiService, useValue: discoveryApiServiceMockValue },
provideMockStore({
initialState: { app: appState }
@@ -39,7 +39,7 @@ import {
reduceSeparators,
sortByOrder
} from '@alfresco/adf-extensions';
import { AppConfigService, AuthModule, LogService } from '@alfresco/adf-core';
import { AppConfigService, LogService, provideCoreAuth } from '@alfresco/adf-core';
import { provideMockStore } from '@ngrx/store/testing';
import { hasQuickShareEnabled } from '@alfresco/aca-shared/rules';
import { MatIconRegistry } from '@angular/material/icon';
@@ -58,8 +58,8 @@ describe('AppExtensionService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [LibTestingModule, AuthModule.forRoot()],
providers: [provideMockStore({ initialState })]
imports: [LibTestingModule],
providers: [provideMockStore({ initialState }), provideCoreAuth()]
});
iconRegistry = TestBed.inject(MatIconRegistry);
@@ -26,10 +26,10 @@ import { AppService } from './app.service';
import { TestBed } from '@angular/core/testing';
import {
AuthenticationService,
NoopAuthModule,
NoopTranslateModule,
NotificationService,
PageTitleService,
provideCoreAuthTesting,
StorageService,
UserPreferencesService
} from '@alfresco/adf-core';
@@ -69,8 +69,9 @@ describe('AppService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopTranslateModule, NoopAuthModule, MatDialogModule, MatSnackBarModule],
imports: [NoopTranslateModule, MatDialogModule, MatSnackBarModule],
providers: [
provideCoreAuthTesting(),
SearchQueryBuilderService,
provideMockStore({}),
{
@@ -23,15 +23,13 @@
*/
import { Injectable, NgModule } from '@angular/core';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core';
import { NoopTranslateModule } from '@alfresco/adf-core';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing';
import { provideEffects } from '@ngrx/effects';
import { provideStore } from '@ngrx/store';
import { CommonModule } from '@angular/common';
import { MatIconTestingModule } from '@angular/material/icon/testing';
import { OverlayModule } from '@angular/cdk/overlay';
import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
@@ -93,20 +91,7 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
}
@NgModule({
exports: [TranslateModule],
imports: [
NoopAnimationsModule,
CommonModule,
RouterTestingModule,
MatIconTestingModule,
OverlayModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderService
}
})
],
imports: [NoopAnimationsModule, NoopTranslateModule, RouterTestingModule, MatIconTestingModule, OverlayModule],
providers: [
provideStore(
{ app: null },
@@ -120,7 +105,6 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
),
provideEffects([]),
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: TranslationService, useClass: TranslationMock },
provideHttpClient(withInterceptorsFromDi())
]
})