mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
AAE-37293 switch to provider api (#4735)
This commit is contained in:
@@ -22,18 +22,9 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { importProvidersFrom, ApplicationConfig, Provider, EnvironmentProviders } from '@angular/core';
|
||||
import { importProvidersFrom, ApplicationConfig } from '@angular/core';
|
||||
import { provideNoopAnimations, provideAnimations } from '@angular/platform-browser/animations';
|
||||
import {
|
||||
AuthGuard,
|
||||
AuthModule,
|
||||
provideTranslations,
|
||||
provideAppConfig,
|
||||
FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
DecimalRenderMiddlewareService,
|
||||
AuthenticationService,
|
||||
TranslateLoaderService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AuthGuard, provideAppConfig, provideCoreAuth, provideI18N } from '@alfresco/adf-core';
|
||||
import { AppService, provideContentAppExtensions } from '@alfresco/aca-shared';
|
||||
import { provideApplicationExtensions } from './extensions.module';
|
||||
import { environment } from '../environments/environment';
|
||||
@@ -59,10 +50,7 @@ import { CONTENT_LAYOUT_ROUTES, ContentServiceExtensionModule, ContentUrlService
|
||||
import { ContentVersionService } from '@alfresco/adf-content-services';
|
||||
import { SHELL_APP_SERVICE, SHELL_AUTH_TOKEN, provideShellRoutes } from '@alfresco/adf-core/shell';
|
||||
import { APP_ROUTES } from './app.routes';
|
||||
import { HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
|
||||
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
import { Authentication, AuthenticationInterceptor } from '@alfresco/adf-core/auth';
|
||||
import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
||||
|
||||
registerLocaleData(localeFr);
|
||||
registerLocaleData(localeDe);
|
||||
@@ -81,40 +69,14 @@ registerLocaleData(localeFi);
|
||||
registerLocaleData(localeDa);
|
||||
registerLocaleData(localeSv);
|
||||
|
||||
/* The replacement for the CoreModule.forRoot() */
|
||||
function provideAdfCore(): (Provider | EnvironmentProviders)[] {
|
||||
return [
|
||||
provideAppConfig(),
|
||||
provideHttpClient(withInterceptorsFromDi(), withXsrfConfiguration({ cookieName: 'CSRF-TOKEN', headerName: 'X-CSRF-TOKEN' })),
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: AuthenticationInterceptor, multi: true },
|
||||
{ provide: Authentication, useClass: AuthenticationService },
|
||||
{
|
||||
provide: MAT_SNACK_BAR_DEFAULT_OPTIONS,
|
||||
useValue: {
|
||||
duration: 10000
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
useClass: DecimalRenderMiddlewareService,
|
||||
multi: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export const AppConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
importProvidersFrom(AuthModule.forRoot({ useHash: true })),
|
||||
provideCoreAuth({ useHash: true }),
|
||||
provideAppConfig(),
|
||||
importProvidersFrom(ContentServiceExtensionModule),
|
||||
provideTranslateService({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderService,
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'en'
|
||||
provideI18N({
|
||||
assets: [['app', 'assets']]
|
||||
}),
|
||||
provideAdfCore(),
|
||||
provideContentAppExtensions(),
|
||||
provideApplicationExtensions(),
|
||||
provideRouter(APP_ROUTES, withHashLocation()),
|
||||
@@ -129,6 +91,11 @@ export const AppConfig: ApplicationConfig = {
|
||||
provide: SHELL_AUTH_TOKEN,
|
||||
useValue: AuthGuard
|
||||
},
|
||||
provideTranslations('app', 'assets')
|
||||
{
|
||||
provide: MAT_SNACK_BAR_DEFAULT_OPTIONS,
|
||||
useValue: {
|
||||
duration: 10000
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { RuleSetPickerOptions, RuleSetPickerSmartComponent } from './rule-set-picker.smart-component';
|
||||
import { NoopAuthModule, NoopTranslateModule, NotificationService, UnitTestingUtils } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, NotificationService, provideCoreAuthTesting, UnitTestingUtils } from '@alfresco/adf-core';
|
||||
import { folderToLinkMock, otherFolderMock } from '../mock/node.mock';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { of } from 'rxjs';
|
||||
@@ -76,9 +76,10 @@ describe('RuleSetPickerSmartComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAuthModule, RuleSetPickerSmartComponent],
|
||||
imports: [NoopTranslateModule, RuleSetPickerSmartComponent],
|
||||
providers: [
|
||||
provideRouter([]),
|
||||
provideCoreAuthTesting(),
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AosEditOnlineService } from './aos-extension.service';
|
||||
import { AppConfigService, AuthenticationService, AuthModule, NotificationService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, AuthenticationService, NotificationService, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { LibTestingModule } from '@alfresco/aca-shared';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
|
||||
@@ -37,7 +37,8 @@ describe('AosEditOnlineService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [LibTestingModule, MatSnackBarModule, AuthModule.forRoot()]
|
||||
imports: [LibTestingModule, MatSnackBarModule],
|
||||
providers: [provideCoreAuthTesting()]
|
||||
});
|
||||
|
||||
aosEditOnlineService = TestBed.inject(AosEditOnlineService);
|
||||
|
@@ -27,7 +27,7 @@ import { Overlay } from '@angular/cdk/overlay';
|
||||
import { Injector } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { of } from 'rxjs';
|
||||
import { NoopTranslateModule, UserPreferencesService, NoopAuthModule } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, UserPreferencesService, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { ContextMenuService } from './context-menu.service';
|
||||
import { ContextMenuComponent } from './context-menu.component';
|
||||
import { ContextmenuOverlayConfig } from './interfaces';
|
||||
@@ -62,8 +62,8 @@ describe('ContextMenuService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, ContextMenuComponent, NoopAuthModule],
|
||||
providers: [Overlay, { provide: Store, useValue: { select: () => of() } }, UserPreferencesService]
|
||||
imports: [NoopTranslateModule, ContextMenuComponent],
|
||||
providers: [provideCoreAuthTesting(), Overlay, { provide: Store, useValue: { select: () => of() } }, UserPreferencesService]
|
||||
});
|
||||
|
||||
injector = TestBed.inject(Injector);
|
||||
@@ -92,7 +92,7 @@ describe('ContextMenuService', () => {
|
||||
|
||||
contextMenuService.open(overlayConfig);
|
||||
|
||||
expect(document.body.querySelector('div[dir="ltr"]')).not.toBe(null);
|
||||
expect(document.body.querySelector('div[dir="ltr"]')).not.toEqual(null);
|
||||
});
|
||||
|
||||
it('should change direction on textOrientation event', () => {
|
||||
|
@@ -27,17 +27,13 @@ import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { DetailsComponent } from './details.component';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { BehaviorSubject, of, Subject } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppExtensionService, AppHookService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { NavigateToFolder, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AuthenticationService, CORE_PIPES, PageTitleService } from '@alfresco/adf-core';
|
||||
import { BreadcrumbComponent, ContentService, NodesApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
@@ -63,9 +59,8 @@ describe('DetailsComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule, DetailsComponent, ...CORE_PIPES, MatSnackBarModule],
|
||||
imports: [AppTestingModule, DetailsComponent],
|
||||
providers: [
|
||||
RouterTestingModule,
|
||||
SearchQueryBuilderService,
|
||||
{ provide: Store, useValue: storeMock },
|
||||
{
|
||||
@@ -74,22 +69,8 @@ describe('DetailsComponent', () => {
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||
params: of({ nodeId: 'someId', activeTab: 'permissions' })
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: PageTitleService,
|
||||
useValue: {}
|
||||
},
|
||||
{
|
||||
provide: AuthenticationService,
|
||||
useValue: {
|
||||
onLogin: new Subject<any>(),
|
||||
onLogout: new Subject<any>(),
|
||||
isLoggedIn: () => true
|
||||
}
|
||||
},
|
||||
...CORE_PIPES
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const appExtensionService = TestBed.inject(AppExtensionService);
|
||||
|
@@ -25,13 +25,11 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DatatableCellBadgesComponent } from './datatable-cell-badges.component';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
import { NoopTranslateModule, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { of } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContentActionType } from '@alfresco/adf-extensions';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import { provideStore } from '@ngrx/store';
|
||||
|
||||
const mockNode = {
|
||||
@@ -55,10 +53,9 @@ describe('DatatableCellBadgesComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAuthModule, DatatableCellBadgesComponent],
|
||||
imports: [NoopTranslateModule, DatatableCellBadgesComponent],
|
||||
providers: [
|
||||
Actions,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideCoreAuthTesting(),
|
||||
provideStore(
|
||||
{ app: (state) => state },
|
||||
{
|
||||
|
@@ -23,23 +23,10 @@
|
||||
*/
|
||||
|
||||
import { CustomNameColumnComponent } from './name-column.component';
|
||||
import { Actions } from '@ngrx/effects';
|
||||
import { provideStore } from '@ngrx/store';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-datatable-cell-badges',
|
||||
standalone: true,
|
||||
template: ''
|
||||
})
|
||||
class MockDatatableCellBadgesComponent {
|
||||
@Input() node: NodeEntry;
|
||||
}
|
||||
import { NoopTranslateModule, provideCoreAuth } from '@alfresco/adf-core';
|
||||
|
||||
describe('CustomNameColumnComponent', () => {
|
||||
let fixture: ComponentFixture<CustomNameColumnComponent>;
|
||||
@@ -47,10 +34,9 @@ describe('CustomNameColumnComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, CustomNameColumnComponent, MockDatatableCellBadgesComponent, AuthModule.forRoot()],
|
||||
imports: [NoopTranslateModule, CustomNameColumnComponent],
|
||||
providers: [
|
||||
Actions,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideCoreAuth(),
|
||||
provideStore(
|
||||
{ app: (state) => state },
|
||||
{
|
||||
|
@@ -28,8 +28,8 @@ import { AppSettingsService } from '@alfresco/aca-shared';
|
||||
import { VersionListDataSource, VersionManagerComponent } from '@alfresco/adf-content-services';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('VersionsTabComponent', () => {
|
||||
let component: VersionsTabComponent;
|
||||
@@ -38,7 +38,8 @@ describe('VersionsTabComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAuthModule, NoopAnimationsModule, VersionsTabComponent]
|
||||
imports: [NoopTranslateModule, VersionsTabComponent],
|
||||
providers: [provideNoopAnimations(), provideCoreAuthTesting()]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(VersionsTabComponent);
|
||||
|
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { BehaviorSubject, ReplaySubject, Subject } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { SavedSearchesService, SavedSearch } from '@alfresco/adf-content-services';
|
||||
@@ -56,8 +56,9 @@ describe('SavedSearchesSmartListComponent', () => {
|
||||
infoDrawerOpened: false
|
||||
};
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAuthModule, SavedSearchesSmartListComponent],
|
||||
imports: [NoopTranslateModule, SavedSearchesSmartListComponent],
|
||||
providers: [
|
||||
provideCoreAuthTesting(),
|
||||
provideMockStore({
|
||||
initialState: { app: appState }
|
||||
}),
|
||||
|
@@ -23,27 +23,27 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { AuthenticationService, NoopTranslateModule, PageTitleService } from '@alfresco/adf-core';
|
||||
import { provideNoopAnimations } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule, PageTitleService, provideCoreAuthTesting } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import { provideStore } from '@ngrx/store';
|
||||
import { appReducer } from '../store/reducers/app.reducer';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { provideEffects } from '@ngrx/effects';
|
||||
import { INITIAL_STATE } from '../store/initial-state';
|
||||
import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
|
||||
import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { DocumentBasePageService } from '@alfresco/aca-shared';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
exports: [RouterTestingModule],
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, RouterTestingModule, MatSnackBarModule, MatDialogModule, MatIconTestingModule],
|
||||
imports: [NoopTranslateModule, MatSnackBarModule, MatDialogModule, MatIconTestingModule],
|
||||
providers: [
|
||||
provideNoopAnimations(),
|
||||
provideRouter([]),
|
||||
provideStore(
|
||||
{ app: appReducer },
|
||||
{
|
||||
@@ -72,24 +72,11 @@ import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: AuthenticationService,
|
||||
useValue: {
|
||||
isEcmLoggedIn: (): boolean => true,
|
||||
getRedirect: (): string | null => null,
|
||||
setRedirect() {},
|
||||
isOauth: (): boolean => false,
|
||||
isOAuthWithoutSilentLogin: (): boolean => false,
|
||||
onLogin: new Subject<any>(),
|
||||
onLogout: new Subject<any>(),
|
||||
isLoggedIn: () => true
|
||||
}
|
||||
},
|
||||
provideCoreAuthTesting(),
|
||||
{
|
||||
provide: PageTitleService,
|
||||
useValue: {}
|
||||
},
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AppTestingModule {}
|
||||
|
@@ -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())
|
||||
]
|
||||
})
|
||||
|
Reference in New Issue
Block a user