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;
|
||||
|
@@ -32,9 +32,7 @@ import {
|
||||
WidgetVisibilityService,
|
||||
provideTranslations,
|
||||
AuthModule,
|
||||
FormFieldEvent,
|
||||
StorageService,
|
||||
JWT_STORAGE_SERVICE
|
||||
FormFieldEvent
|
||||
} from '@alfresco/adf-core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { ESCAPE } from '@angular/cdk/keycodes';
|
||||
@@ -1474,7 +1472,7 @@ describe('Multilingual Form', () => {
|
||||
CoreModule.forRoot(),
|
||||
ProcessServicesCloudModule.forRoot()
|
||||
],
|
||||
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }, provideTranslations('app', 'resources')]
|
||||
providers: [provideTranslations('app', 'resources')]
|
||||
});
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
formCloudService = TestBed.inject(FormCloudService);
|
||||
@@ -1547,8 +1545,7 @@ describe('retrieve metadata on submit', () => {
|
||||
{
|
||||
provide: VersionCompatibilityService,
|
||||
useValue: {}
|
||||
},
|
||||
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }
|
||||
}
|
||||
]
|
||||
});
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { ADF_DATE_FORMATS, FullNamePipe, JWT_STORAGE_SERVICE, NoopTranslateModule, StorageService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ADF_DATE_FORMATS, FullNamePipe, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
@@ -121,8 +121,7 @@ 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: JWT_STORAGE_SERVICE, useClass: StorageService }
|
||||
{ provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserServiceMock }
|
||||
],
|
||||
declarations: [PeopleCloudComponent, DateRangeFilterComponent]
|
||||
});
|
||||
|
Reference in New Issue
Block a user