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);