Fixed related unit test

This commit is contained in:
VitoAlbano
2024-10-14 13:18:32 +01:00
parent 1869b78e0e
commit 98359e1073
4 changed files with 12 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
import { JwtHelperService, JWT_STORAGE_SERVICE } from '../services/jwt-helper.service';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { NoopTranslateModule } from '../../testing/noop-translate.module';
import { StorageService } from '../../common';
describe('Auth Guard SSO role service', () => {
let jwtHelperService: JwtHelperService;
@@ -30,7 +31,7 @@ describe('Auth Guard SSO role service', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopTranslateModule, MatDialogModule],
providers: [{ provide: JWT_STORAGE_SERVICE, useValue: { getItem: () => {}, setItem: () => {}, removeItem: () => {} } }]
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }]
});
localStorage.clear();
jwtHelperService = TestBed.inject(JwtHelperService);

View File

@@ -20,6 +20,7 @@ import { UserAccessService } from './user-access.service';
import { JwtHelperService, JWT_STORAGE_SERVICE } from './jwt-helper.service';
import { AppConfigService } from '../../app-config';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { StorageService } from '../../common';
describe('UserAccessService', () => {
let userAccessService: UserAccessService;
@@ -29,7 +30,7 @@ describe('UserAccessService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [UserAccessService, { provide: JWT_STORAGE_SERVICE, useValue: {} }]
providers: [UserAccessService, { provide: JWT_STORAGE_SERVICE, useValue: StorageService }]
});
userAccessService = TestBed.inject(UserAccessService);
jwtHelperService = TestBed.inject(JwtHelperService);

View File

@@ -16,7 +16,7 @@
*/
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { ADF_DATE_FORMATS, FullNamePipe, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
import { ADF_DATE_FORMATS, FullNamePipe, JWT_STORAGE_SERVICE, NoopTranslateModule, StorageService, UserPreferencesService } from '@alfresco/adf-core';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { SimpleChange } from '@angular/core';
@@ -121,7 +121,8 @@ describe('EditProcessFilterCloudComponent', () => {
{ provide: DateAdapter, useClass: DateFnsAdapter },
{ provide: NotificationCloudService, useValue: { makeGQLQuery: () => of([]) } },
{ provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS },
{ provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserServiceMock }
{ provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserServiceMock },
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }
],
declarations: [PeopleCloudComponent, DateRangeFilterComponent]
});

View File

@@ -24,7 +24,9 @@ import {
TranslationService,
TranslationMock,
CoreModule,
AuthModule
AuthModule,
JWT_STORAGE_SERVICE,
StorageService
} from '@alfresco/adf-core';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
import { TranslateModule } from '@ngx-translate/core';
@@ -44,7 +46,8 @@ import { RouterTestingModule } from '@angular/router/testing';
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
{ provide: TranslationService, useClass: TranslationMock }
{ provide: TranslationService, useClass: TranslationMock },
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }
],
exports: [NoopAnimationsModule, TranslateModule, CoreModule, ProcessServicesCloudModule]
})