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