mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-24 14:31:41 +00:00
fix unit
This commit is contained in:
@@ -15,20 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
createNewPersonMock,
|
||||
fakeEcmAdminUser,
|
||||
fakeEcmUser,
|
||||
fakeEcmUser2,
|
||||
fakeEcmUserList
|
||||
} from '../mocks/ecm-user.service.mock';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AlfrescoApiServiceMock,
|
||||
AuthenticationService,
|
||||
CoreTestingModule,
|
||||
LogService
|
||||
} from '@alfresco/adf-core';
|
||||
import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmUser2, fakeEcmAdminUser, fakeEcmUserList } from '../mocks/ecm-user.service.mock';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AuthenticationService, CoreTestingModule, LogService } from '@alfresco/adf-core';
|
||||
import { PeopleContentQueryRequestModel, PeopleContentService } from './people-content.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
@@ -37,7 +25,6 @@ describe('PeopleContentService', () => {
|
||||
|
||||
let peopleContentService: PeopleContentService;
|
||||
let logService: LogService;
|
||||
let authenticationService: AuthenticationService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -50,7 +37,6 @@ describe('PeopleContentService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
authenticationService = TestBed.inject(AuthenticationService);
|
||||
peopleContentService = TestBed.inject(PeopleContentService);
|
||||
logService = TestBed.inject(LogService);
|
||||
});
|
||||
@@ -133,7 +119,7 @@ describe('PeopleContentService', () => {
|
||||
|
||||
await peopleContentService.getCurrentUserInfo().toPromise();
|
||||
|
||||
expect(await peopleContentService.isCurrentUserAdmin()).toBe(true);
|
||||
expect(peopleContentService.isCurrentUserAdmin()).toBe(true);
|
||||
expect(getCurrentPersonSpy.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
|
@@ -18,8 +18,7 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { LibraryFavoriteDirective } from './library-favorite.directive';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoApiServiceMock, CoreModule, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { LibraryEntity } from '../interfaces/library-entity.interface';
|
||||
|
||||
@Component({
|
||||
@@ -40,10 +39,7 @@ describe('LibraryFavoriteDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), CoreModule.forRoot()],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
|
||||
],
|
||||
imports: [CoreTestingModule],
|
||||
declarations: [TestComponent, LibraryFavoriteDirective]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
|
@@ -289,7 +289,8 @@ export class AdfHttpClient implements ee.Emitter,JsApiHttpClient {
|
||||
}
|
||||
|
||||
private createCSRFToken(a?: any): string {
|
||||
return a ? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);
|
||||
const randomValue = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
return a ? (a ^ ((randomValue * 16) >> (a / 4))).toString(16) : ([1e16] + (1e16).toString()).replace(/[01]/g, this.createCSRFToken);
|
||||
}
|
||||
|
||||
private static getResponseType(options: RequestOptions): 'blob' | 'json' | 'text' {
|
||||
|
@@ -26,7 +26,7 @@ export function loadAppConfig(appConfigService: AppConfigService, storageService
|
||||
storageService.prefix = appConfigService.get<string>(AppConfigValues.STORAGE_PREFIX, '');
|
||||
|
||||
appConfigService.select(AppConfigValues.STORAGE_PREFIX).subscribe((property) => {
|
||||
storageService.prefix = property
|
||||
storageService.prefix = property;
|
||||
});
|
||||
};
|
||||
return () => appConfigService.load(init);
|
||||
|
@@ -78,7 +78,7 @@ export class AppConfigService {
|
||||
onLoad: Observable<any>;
|
||||
|
||||
get isLoaded() {
|
||||
return this.status = Status.LOADED;
|
||||
return this.status === Status.LOADED;
|
||||
}
|
||||
|
||||
constructor(protected http: HttpClient, protected extensionService: ExtensionService) {
|
||||
|
@@ -196,7 +196,7 @@ export class ContentAuth {
|
||||
if (ticketBodyCreate === null || ticketBodyCreate === undefined) {
|
||||
this.onError.next((`Missing param ticketBodyCreate`));
|
||||
|
||||
throw new Error(`Missing param '${name}'`);
|
||||
throw new Error(`Missing param ticketBodyCreate`);
|
||||
}
|
||||
|
||||
return this.adfHttpClient.post(this.basePath + '/tickets', {bodyParam: ticketBodyCreate});
|
||||
|
@@ -100,7 +100,7 @@ export abstract class BaseAuthenticationService implements AuthenticationService
|
||||
isBPMProvider(): boolean {
|
||||
const provider = this.appConfig.get('providers');
|
||||
if (provider && (typeof provider === 'string' || provider instanceof String)) {
|
||||
return provider && provider.toUpperCase() === 'BPM';
|
||||
return provider.toUpperCase() === 'BPM';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ import { CookieServiceMock } from '../mock/cookie.service.mock';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { directionalityConfigFactory } from '../common/services/directionality-config-factory';
|
||||
import { DirectionalityConfigService } from '../common/services/directionality-config.service';
|
||||
import { AuthModule } from "../auth";
|
||||
import { AuthModule } from '../auth';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -20,6 +20,7 @@ import { TranslateLoaderService } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreModule } from '../core.module';
|
||||
import { AuthModule } from '../auth';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -30,6 +31,7 @@ describe('TranslateLoader', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
|
@@ -1227,10 +1227,11 @@ describe('retrieve metadata on submit', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
FormCloudModule
|
||||
FormCloudModule,
|
||||
],
|
||||
providers: [
|
||||
provideTranslations('app', 'resources'),
|
||||
|
@@ -82,7 +82,6 @@ export class IdentityService {
|
||||
const method = 'DELETE';
|
||||
const queryParams = {};
|
||||
const postBody = {};
|
||||
return this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
|
||||
const deletePromise = this.api.performIdentityOperation(path, method, queryParams, postBody);
|
||||
|
||||
|
Reference in New Issue
Block a user