Skip to content

Commit

Permalink
[AAE-12502] Fix failed unit tests caused by Alfresco/alfresco-ng2-com…
Browse files Browse the repository at this point in the history
  • Loading branch information
alep85 committed Sep 11, 2023
1 parent 94087d4 commit a50aed4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@

import { TestBed } from '@angular/core/testing';
import { AosEditOnlineService } from './aos-extension.service';
import { AppConfigService, AuthenticationService, LogService, NotificationService } from '@alfresco/adf-core';
import { AppConfigService, AuthenticationService, LogService, NotificationService, RedirectAuthService } from '@alfresco/adf-core';
import { LibTestingModule } from '@alfresco/aca-shared';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { EMPTY } from 'rxjs';

describe('AosEditOnlineService', () => {
let aosEditOnlineService: AosEditOnlineService;
Expand All @@ -38,7 +39,10 @@ describe('AosEditOnlineService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [LibTestingModule, MatSnackBarModule],
providers: [{ provide: LogService, useValue: { error() {} } }]
providers: [
{ provide: LogService, useValue: { error() {} } },
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY } }
]
});

aosEditOnlineService = TestBed.inject(AosEditOnlineService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { CoreModule, UserPreferencesService } from '@alfresco/adf-core';
import { AuthenticationService, CoreModule, UserPreferencesService } from '@alfresco/adf-core';
import { ContextMenuService } from './context-menu.service';
import { TranslateModule } from '@ngx-translate/core';
import { ContextMenuComponent } from './context-menu.component';
Expand All @@ -52,7 +52,12 @@ describe('ContextMenuService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule.forRoot(), ContextMenuComponent],
providers: [Overlay, { provide: Store, useValue: { select: () => of() } }, UserPreferencesService]
providers: [
Overlay,
{ provide: Store, useValue: { select: () => of() } },
{ provide: AuthenticationService, useValue: { getToken: () => 'fake token' } },
UserPreferencesService
]
});

injector = TestBed.inject(Injector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { Store, StoreModule } from '@ngrx/store';
import { Component, Injectable } from '@angular/core';
import { DiscoveryApiService, DocumentListComponent } from '@alfresco/adf-content-services';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { MaterialModule, PipeModule } from '@alfresco/adf-core';
import { AuthenticationService, MaterialModule, PipeModule } from '@alfresco/adf-core';
import { HttpClientModule } from '@angular/common/http';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
Expand Down Expand Up @@ -151,6 +151,7 @@ describe('PageComponent', () => {
)
}
},
{ provide: AuthenticationService, useValue: { getToken: () => 'fake token' } },
AppExtensionService
]
});
Expand Down Expand Up @@ -315,6 +316,7 @@ describe('Info Drawer state', () => {
)
}
},
{ provide: AuthenticationService, useValue: { getToken: () => 'fake token' } },
provideMockStore({
initialState: { app: appState }
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
ExtensionConfig,
NavBarGroupRef
} from '@alfresco/adf-extensions';
import { AppConfigService, LogService } from '@alfresco/adf-core';
import { AppConfigService, AuthenticationService, LogService } from '@alfresco/adf-core';
import { provideMockStore } from '@ngrx/store/testing';
import { hasQuickShareEnabled } from '@alfresco/aca-shared/rules';
import { MatIconRegistry } from '@angular/material/icon';
Expand All @@ -56,7 +56,7 @@ describe('AppExtensionService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [LibTestingModule],
providers: [provideMockStore({ initialState })]
providers: [{ provide: AuthenticationService, useValue: { getToken: () => 'fake token' } }, provideMockStore({ initialState })]
});

iconRegistry = TestBed.inject(MatIconRegistry);
Expand Down

0 comments on commit a50aed4

Please sign in to comment.