mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Fixed unit tests
This commit is contained in:
@@ -27,8 +27,6 @@ import { EMPTY, of } from 'rxjs';
|
||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||
import { AuthGuardService } from './auth-guard.service';
|
||||
import { NoopTranslateModule } from '../../testing/noop-translate.module';
|
||||
import { JWT_STORAGE_SERVICE } from '../public-api';
|
||||
import { StorageService } from '../../common';
|
||||
|
||||
describe('AuthGuardService BPM', () => {
|
||||
let authGuard: Promise<boolean>;
|
||||
@@ -47,7 +45,6 @@ describe('AuthGuardService BPM', () => {
|
||||
providers: [
|
||||
AuthGuardService,
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
|
||||
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService },
|
||||
{
|
||||
provide: OidcAuthenticationService,
|
||||
useValue: {
|
||||
|
@@ -27,8 +27,7 @@ import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||
import { NoopTranslateModule } from '../../testing/noop-translate.module';
|
||||
import { JWT_STORAGE_SERVICE } from '../public-api';
|
||||
import { StorageService } from '../../common';
|
||||
|
||||
|
||||
describe('AuthGuardService ECM', () => {
|
||||
let authGuard: Promise<boolean>;
|
||||
@@ -56,8 +55,7 @@ describe('AuthGuardService ECM', () => {
|
||||
shouldPerformSsoLogin$: of(true)
|
||||
}
|
||||
},
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
|
||||
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }
|
||||
]
|
||||
});
|
||||
localStorage.clear();
|
||||
|
@@ -18,10 +18,9 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
||||
import { JwtHelperService, JWT_STORAGE_SERVICE } from '../services/jwt-helper.service';
|
||||
import { JwtHelperService } 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,8 +29,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, MatDialogModule],
|
||||
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }]
|
||||
imports: [NoopTranslateModule, MatDialogModule]
|
||||
});
|
||||
localStorage.clear();
|
||||
jwtHelperService = TestBed.inject(JwtHelperService);
|
||||
|
@@ -28,7 +28,6 @@ import { EMPTY, of } from 'rxjs';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NoopTranslateModule } from '../../testing/noop-translate.module';
|
||||
import { JWT_STORAGE_SERVICE } from '../public-api';
|
||||
|
||||
describe('AuthGuardService', () => {
|
||||
let state: RouterStateSnapshot;
|
||||
@@ -46,7 +45,6 @@ describe('AuthGuardService', () => {
|
||||
imports: [NoopTranslateModule, MatDialogModule, RouterTestingModule],
|
||||
providers: [
|
||||
AppConfigService,
|
||||
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService },
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
|
||||
{
|
||||
provide: OidcAuthenticationService,
|
||||
|
@@ -65,6 +65,7 @@ describe('OidcAuthenticationService', () => {
|
||||
{ provide: OAuthService, useClass: MockOAuthService },
|
||||
{ provide: OAuthStorage, useValue: {} },
|
||||
{ provide: AUTH_MODULE_CONFIG, useValue: {} },
|
||||
{ provide: AuthService, useValue: {} }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(OidcAuthenticationService);
|
||||
|
@@ -29,7 +29,7 @@ import {
|
||||
} from '../mock/identity-user.mock';
|
||||
import { mockGroups, mockJoinGroupRequest } from '../mock/identity-group.mock';
|
||||
import { IdentityUserService } from './identity-user.service';
|
||||
import { JwtHelperService, JWT_STORAGE_SERVICE } from './jwt-helper.service';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||
import { IdentityRoleModel } from '../models/identity-role.model';
|
||||
import { AdfHttpClient } from '../../../../api/src';
|
||||
@@ -53,7 +53,7 @@ describe('IdentityUserService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }, AdfHttpClient]
|
||||
providers: [AdfHttpClient]
|
||||
});
|
||||
storageService = TestBed.inject(StorageService);
|
||||
service = TestBed.inject(IdentityUserService);
|
||||
|
@@ -15,11 +15,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JWT_STORAGE_SERVICE, JwtHelperService } from './jwt-helper.service';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { StorageService } from '../../common';
|
||||
import { OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { JWT_STORAGE_SERVICE } from '../oidc/auth.module';
|
||||
|
||||
const mockStorage = {
|
||||
access_token: 'my-access_token',
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { UserAccessService } from './user-access.service';
|
||||
import { JwtHelperService, JWT_STORAGE_SERVICE } from './jwt-helper.service';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { AppConfigService } from '../../app-config';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { StorageService } from '../../common';
|
||||
@@ -30,7 +30,7 @@ describe('UserAccessService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }, UserAccessService]
|
||||
providers: [UserAccessService]
|
||||
});
|
||||
userAccessService = TestBed.inject(UserAccessService);
|
||||
jwtHelperService = TestBed.inject(JwtHelperService);
|
||||
|
@@ -22,7 +22,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreModule } from '../core.module';
|
||||
import { AuthModule } from '../auth/oidc/auth.module';
|
||||
import { StorageService } from '../common';
|
||||
import { JWT_STORAGE_SERVICE } from '../auth/services/jwt-helper.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -33,7 +32,7 @@ describe('TranslateLoader', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AuthModule.forRoot({ useHash: true }), TranslateModule.forRoot(), CoreModule.forRoot()],
|
||||
providers: [TranslationService, { provide: JWT_STORAGE_SERVICE, useClass: StorageService }]
|
||||
providers: [TranslationService]
|
||||
});
|
||||
translationService = TestBed.inject(TranslationService);
|
||||
customLoader = translationService.translate.currentLoader as TranslateLoaderService;
|
||||
|
Reference in New Issue
Block a user