mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[affected:*][ci:force] - REBASED
This commit is contained in:
@@ -58,23 +58,19 @@ describe('AdfHttpClient', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [HttpClientTestingModule],
|
||||||
HttpClientTestingModule
|
providers: [AdfHttpClient]
|
||||||
]
|
|
||||||
});
|
});
|
||||||
angularHttpClient = TestBed.inject(AdfHttpClient);
|
angularHttpClient = TestBed.inject(AdfHttpClient);
|
||||||
controller = TestBed.inject(HttpTestingController);
|
controller = TestBed.inject(HttpTestingController);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('deserialize', () => {
|
describe('deserialize', () => {
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
controller.verify();
|
controller.verify();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should deserialize incoming request based on return type', (done) => {
|
it('should deserialize incoming request based on return type', (done) => {
|
||||||
|
|
||||||
const options: RequestOptions = {
|
const options: RequestOptions = {
|
||||||
path: '',
|
path: '',
|
||||||
httpMethod: 'POST',
|
httpMethod: 'POST',
|
||||||
@@ -85,38 +81,41 @@ describe('AdfHttpClient', () => {
|
|||||||
accepts: ['application/json']
|
accepts: ['application/json']
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).then((res: ResultListDataRepresentationTaskRepresentation) => {
|
angularHttpClient
|
||||||
|
.request('http://example.com', options, securityOptions, emitters)
|
||||||
|
.then((res: ResultListDataRepresentationTaskRepresentation) => {
|
||||||
expect(res instanceof ResultListDataRepresentationTaskRepresentation).toBeTruthy();
|
expect(res instanceof ResultListDataRepresentationTaskRepresentation).toBeTruthy();
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
expect(res.data![0].created instanceof Date).toBeTruthy();
|
expect(res.data![0].created instanceof Date).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
}).catch(error=> fail(error));
|
})
|
||||||
|
.catch((error) => fail(error));
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com');
|
const req = controller.expectOne('http://example.com');
|
||||||
expect(req.request.method).toEqual('POST');
|
expect(req.request.method).toEqual('POST');
|
||||||
|
|
||||||
req.flush(mockResponse);
|
req.flush(mockResponse);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return parsed json object when responseType is json', (done) => {
|
it('should return parsed json object when responseType is json', (done) => {
|
||||||
|
|
||||||
const options: RequestOptions = {
|
const options: RequestOptions = {
|
||||||
path: '',
|
path: '',
|
||||||
httpMethod: 'POST',
|
httpMethod: 'POST',
|
||||||
responseType: 'json'
|
responseType: 'json'
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).then((res) => {
|
angularHttpClient
|
||||||
|
.request('http://example.com', options, securityOptions, emitters)
|
||||||
|
.then((res) => {
|
||||||
expect(res).toEqual(mockResponse);
|
expect(res).toEqual(mockResponse);
|
||||||
done();
|
done();
|
||||||
}).catch(error=> fail(error));
|
})
|
||||||
|
.catch((error) => fail(error));
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com');
|
const req = controller.expectOne('http://example.com');
|
||||||
expect(req.request.method).toEqual('POST');
|
expect(req.request.method).toEqual('POST');
|
||||||
|
|
||||||
req.flush(mockResponse);
|
req.flush(mockResponse);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit unauthorized message for 401 request', (done) => {
|
it('should emit unauthorized message for 401 request', (done) => {
|
||||||
@@ -137,11 +136,9 @@ describe('AdfHttpClient', () => {
|
|||||||
|
|
||||||
req.flush('<div></div>', { status: 401, statusText: 'unauthorized' });
|
req.flush('<div></div>', { status: 401, statusText: 'unauthorized' });
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('upload', () => {
|
describe('upload', () => {
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
controller.verify();
|
controller.verify();
|
||||||
});
|
});
|
||||||
@@ -177,9 +174,7 @@ describe('AdfHttpClient', () => {
|
|||||||
returnType: null
|
returnType: null
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', requestOptions, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', requestOptions, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
const req = controller.expectOne('http://example.com?autoRename=true&include=allowableOperations');
|
const req = controller.expectOne('http://example.com?autoRename=true&include=allowableOperations');
|
||||||
expect(req.request.method).toEqual('POST');
|
expect(req.request.method).toEqual('POST');
|
||||||
|
|
||||||
@@ -251,19 +246,18 @@ describe('AdfHttpClient', () => {
|
|||||||
httpMethod: 'POST',
|
httpMethod: 'POST',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
status: [
|
status: ['RUNNING', 'SUSPENDED'],
|
||||||
'RUNNING',
|
|
||||||
'SUSPENDED'
|
|
||||||
],
|
|
||||||
sort: 'startDate,DESC'
|
sort: 'startDate,DESC'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com/candidatebaseapp/query/v1/process-instances', options, securityOptions, emitters).catch(error =>
|
angularHttpClient
|
||||||
fail(error)
|
.request('http://example.com/candidatebaseapp/query/v1/process-instances', options, securityOptions, emitters)
|
||||||
);
|
.catch((error) => fail(error));
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com/candidatebaseapp/query/v1/process-instances?skipCount=0&status=RUNNING&status=SUSPENDED&sort=startDate%2CDESC');
|
const req = controller.expectOne(
|
||||||
|
'http://example.com/candidatebaseapp/query/v1/process-instances?skipCount=0&status=RUNNING&status=SUSPENDED&sort=startDate%2CDESC'
|
||||||
|
);
|
||||||
expect(req.request.method).toEqual('POST');
|
expect(req.request.method).toEqual('POST');
|
||||||
|
|
||||||
req.flush(null, { status: 200, statusText: 'Ok' });
|
req.flush(null, { status: 200, statusText: 'Ok' });
|
||||||
@@ -275,10 +269,13 @@ describe('AdfHttpClient', () => {
|
|||||||
httpMethod: 'GET'
|
httpMethod: 'GET'
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).then((res) => {
|
angularHttpClient
|
||||||
|
.request('http://example.com', options, securityOptions, emitters)
|
||||||
|
.then((res) => {
|
||||||
expect(res).toEqual('');
|
expect(res).toEqual('');
|
||||||
done();
|
done();
|
||||||
}).catch(error=> fail(error));
|
})
|
||||||
|
.catch((error) => fail(error));
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com');
|
const req = controller.expectOne('http://example.com');
|
||||||
|
|
||||||
@@ -294,9 +291,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000%2B02%3A00');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000%2B02%3A00');
|
||||||
|
|
||||||
@@ -312,9 +307,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
||||||
|
|
||||||
@@ -331,9 +324,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
||||||
|
|
||||||
@@ -352,9 +343,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
||||||
|
|
||||||
@@ -372,9 +361,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
||||||
|
|
||||||
@@ -392,9 +379,7 @@ describe('AdfHttpClient', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(error =>
|
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch((error) => fail(error));
|
||||||
fail(error)
|
|
||||||
);
|
|
||||||
|
|
||||||
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
const req = controller.expectOne('http://example.com?lastModifiedFrom=2022-08-17T00%3A00%3A00.000Z');
|
||||||
|
|
||||||
@@ -402,5 +387,4 @@ describe('AdfHttpClient', () => {
|
|||||||
|
|
||||||
req.flush(null, { status: 200, statusText: 'Ok' });
|
req.flush(null, { status: 200, statusText: 'Ok' });
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -16,9 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
|
||||||
import { AboutServerSettingsComponent } from './about-server-settings.component';
|
import { AboutServerSettingsComponent } from './about-server-settings.component';
|
||||||
import { AppConfigService } from '../../app-config/app-config.service';
|
import { AppConfigService } from '../../app-config/app-config.service';
|
||||||
|
import { aboutGithubDetails } from '../about.mock';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { AppConfigServiceMock } from '../../common';
|
||||||
|
|
||||||
const aboutGithubDetails = {
|
const aboutGithubDetails = {
|
||||||
url: 'https://github.com/componany/repository/commits/',
|
url: 'https://github.com/componany/repository/commits/',
|
||||||
@@ -36,7 +39,8 @@ describe('AboutServerSettingsComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule]
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||||
|
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(AboutServerSettingsComponent);
|
fixture = TestBed.createComponent(AboutServerSettingsComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
@@ -20,10 +20,13 @@ import { AppConfigService } from '../../app-config/app-config.service';
|
|||||||
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
||||||
import { AuthenticationService } from '../services/authentication.service';
|
import { AuthenticationService } from '../services/authentication.service';
|
||||||
import { RouterStateSnapshot, Router } from '@angular/router';
|
import { RouterStateSnapshot, Router } from '@angular/router';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
import { OidcAuthenticationService } from '../services/oidc-authentication.service';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||||
|
import { EMPTY } from 'rxjs';
|
||||||
|
|
||||||
describe('AuthGuardService BPM', () => {
|
describe('AuthGuardService BPM', () => {
|
||||||
let authGuard: AuthGuardBpm;
|
let authGuard: AuthGuardBpm;
|
||||||
@@ -36,8 +39,9 @@ describe('AuthGuardService BPM', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule],
|
||||||
providers: [
|
providers: [
|
||||||
|
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY } },
|
||||||
{
|
{
|
||||||
provide: OidcAuthenticationService,
|
provide: OidcAuthenticationService,
|
||||||
useValue: {
|
useValue: {
|
||||||
|
@@ -20,10 +20,14 @@ import { AppConfigService } from '../../app-config/app-config.service';
|
|||||||
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
||||||
import { AuthenticationService } from '../services/authentication.service';
|
import { AuthenticationService } from '../services/authentication.service';
|
||||||
import { RouterStateSnapshot, Router } from '@angular/router';
|
import { RouterStateSnapshot, Router } from '@angular/router';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
import { OidcAuthenticationService } from '../services/oidc-authentication.service';
|
||||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||||
|
import { EMPTY } from 'rxjs';
|
||||||
|
|
||||||
describe('AuthGuardService ECM', () => {
|
describe('AuthGuardService ECM', () => {
|
||||||
let authGuard: AuthGuardEcm;
|
let authGuard: AuthGuardEcm;
|
||||||
@@ -35,8 +39,10 @@ describe('AuthGuardService ECM', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule, RouterTestingModule, MatDialogModule],
|
||||||
providers: [
|
providers: [
|
||||||
|
BasicAlfrescoAuthService,
|
||||||
|
AppConfigService,
|
||||||
{
|
{
|
||||||
provide: OidcAuthenticationService,
|
provide: OidcAuthenticationService,
|
||||||
useValue: {
|
useValue: {
|
||||||
@@ -45,7 +51,8 @@ describe('AuthGuardService ECM', () => {
|
|||||||
hasValidIdToken: () => false,
|
hasValidIdToken: () => false,
|
||||||
isLoggedIn: () => false
|
isLoggedIn: () => false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY } }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
@@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
|
||||||
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
||||||
import { JwtHelperService } from '../services/jwt-helper.service';
|
import { JwtHelperService } from '../services/jwt-helper.service';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
describe('Auth Guard SSO role service', () => {
|
describe('Auth Guard SSO role service', () => {
|
||||||
let authGuard: AuthGuardSsoRoleService;
|
let authGuard: AuthGuardSsoRoleService;
|
||||||
@@ -29,7 +30,7 @@ describe('Auth Guard SSO role service', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule]
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule]
|
||||||
});
|
});
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
authGuard = TestBed.inject(AuthGuardSsoRoleService);
|
authGuard = TestBed.inject(AuthGuardSsoRoleService);
|
||||||
|
@@ -20,10 +20,15 @@ import { Router, RouterStateSnapshot } from '@angular/router';
|
|||||||
import { AppConfigService } from '../../app-config/app-config.service';
|
import { AppConfigService } from '../../app-config/app-config.service';
|
||||||
import { AuthGuard } from './auth-guard.service';
|
import { AuthGuard } from './auth-guard.service';
|
||||||
import { AuthenticationService } from '../services/authentication.service';
|
import { AuthenticationService } from '../services/authentication.service';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||||
|
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||||
|
import { EMPTY } from 'rxjs';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
describe('AuthGuardService', () => {
|
describe('AuthGuardService', () => {
|
||||||
let state;
|
let state;
|
||||||
@@ -37,8 +42,11 @@ describe('AuthGuardService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule, RouterTestingModule],
|
||||||
providers: [
|
providers: [
|
||||||
|
AppConfigService,
|
||||||
|
StorageService,
|
||||||
|
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY } },
|
||||||
{
|
{
|
||||||
provide: OidcAuthenticationService,
|
provide: OidcAuthenticationService,
|
||||||
useValue: {
|
useValue: {
|
||||||
|
@@ -27,8 +27,9 @@ import {
|
|||||||
mockIdentityGroups,
|
mockIdentityGroups,
|
||||||
roleMappingMock
|
roleMappingMock
|
||||||
} from '../mock/identity-group.mock';
|
} from '../mock/identity-group.mock';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { AdfHttpClient } from '../../../../api/src';
|
import { AdfHttpClient } from '../../../../api/src';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
describe('IdentityGroupService', () => {
|
describe('IdentityGroupService', () => {
|
||||||
let service: IdentityGroupService;
|
let service: IdentityGroupService;
|
||||||
@@ -37,7 +38,8 @@ describe('IdentityGroupService', () => {
|
|||||||
|
|
||||||
beforeEach(fakeAsync(() => {
|
beforeEach(fakeAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule]
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||||
|
providers: [AdfHttpClient]
|
||||||
});
|
});
|
||||||
service = TestBed.inject(IdentityGroupService);
|
service = TestBed.inject(IdentityGroupService);
|
||||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||||
|
@@ -32,9 +32,10 @@ import { IdentityUserService } from './identity-user.service';
|
|||||||
import { JwtHelperService } from './jwt-helper.service';
|
import { JwtHelperService } from './jwt-helper.service';
|
||||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||||
import { IdentityRoleModel } from '../models/identity-role.model';
|
import { IdentityRoleModel } from '../models/identity-role.model';
|
||||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { AdfHttpClient } from '../../../../api/src';
|
import { AdfHttpClient } from '../../../../api/src';
|
||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
describe('IdentityUserService', () => {
|
describe('IdentityUserService', () => {
|
||||||
const mockRoles = [
|
const mockRoles = [
|
||||||
@@ -52,7 +53,8 @@ describe('IdentityUserService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule]
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||||
|
providers: [StorageService, AdfHttpClient]
|
||||||
});
|
});
|
||||||
storageService = TestBed.inject(StorageService);
|
storageService = TestBed.inject(StorageService);
|
||||||
service = TestBed.inject(IdentityUserService);
|
service = TestBed.inject(IdentityUserService);
|
||||||
|
@@ -15,11 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CoreTestingModule } from '../../testing';
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { UserAccessService } from './user-access.service';
|
import { UserAccessService } from './user-access.service';
|
||||||
import { JwtHelperService } from './jwt-helper.service';
|
import { JwtHelperService } from './jwt-helper.service';
|
||||||
import { AppConfigService } from '../../app-config';
|
import { AppConfigService } from '../../app-config';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
describe('UserAccessService', () => {
|
describe('UserAccessService', () => {
|
||||||
let userAccessService: UserAccessService;
|
let userAccessService: UserAccessService;
|
||||||
@@ -28,7 +28,7 @@ describe('UserAccessService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [HttpClientTestingModule],
|
||||||
providers: [UserAccessService]
|
providers: [UserAccessService]
|
||||||
});
|
});
|
||||||
userAccessService = TestBed.inject(UserAccessService);
|
userAccessService = TestBed.inject(UserAccessService);
|
||||||
@@ -83,7 +83,6 @@ describe('UserAccessService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Access present in realm_access', () => {
|
describe('Access present in realm_access', () => {
|
||||||
|
|
||||||
it('should return true when the user has one of the global roles', () => {
|
it('should return true when the user has one of the global roles', () => {
|
||||||
spyRealmAccess(['MOCK_USER_ROLE', 'MOCK_USER_ROLE_2'], {});
|
spyRealmAccess(['MOCK_USER_ROLE', 'MOCK_USER_ROLE_2'], {});
|
||||||
userAccessService.fetchUserAccess();
|
userAccessService.fetchUserAccess();
|
||||||
@@ -118,7 +117,6 @@ describe('UserAccessService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Access present in hxp_authorization', () => {
|
describe('Access present in hxp_authorization', () => {
|
||||||
|
|
||||||
it('should return true when the user has one of the global roles', () => {
|
it('should return true when the user has one of the global roles', () => {
|
||||||
spyHxpAuthorization('mockApp1', ['MOCK_GLOBAL_USER_ROLE']);
|
spyHxpAuthorization('mockApp1', ['MOCK_GLOBAL_USER_ROLE']);
|
||||||
appConfigService.config = { application: { key: 'mockApp1' } };
|
appConfigService.config = { application: { key: 'mockApp1' } };
|
||||||
|
@@ -21,7 +21,7 @@ import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
|
|||||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||||
import { CardViewBoolItemComponent } from './card-view-boolitem.component';
|
import { CardViewBoolItemComponent } from './card-view-boolitem.component';
|
||||||
import { CardViewBoolItemModel } from '../../models/card-view-boolitem.model';
|
import { CardViewBoolItemModel } from '../../models/card-view-boolitem.model';
|
||||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('CardViewBoolItemComponent', () => {
|
describe('CardViewBoolItemComponent', () => {
|
||||||
let fixture: ComponentFixture<CardViewBoolItemComponent>;
|
let fixture: ComponentFixture<CardViewBoolItemComponent>;
|
||||||
@@ -29,7 +29,7 @@ describe('CardViewBoolItemComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule]
|
imports: [TranslateModule.forRoot()]
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(CardViewBoolItemComponent);
|
fixture = TestBed.createComponent(CardViewBoolItemComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
@@ -20,7 +20,6 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
|
||||||
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
import { ClipboardService } from '../../../clipboard/clipboard.service';
|
||||||
import { CardViewDatetimeItemModel } from '../../models/card-view-datetimeitem.model';
|
import { CardViewDatetimeItemModel } from '../../models/card-view-datetimeitem.model';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@@ -29,6 +28,14 @@ import { MatDatetimepickerInputEvent } from '@mat-datetimepicker/core';
|
|||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatChipHarness } from '@angular/material/chips/testing';
|
import { MatChipHarness } from '@angular/material/chips/testing';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
|
import { TranslationMock } from '../../../mock';
|
||||||
|
import { TranslationService } from '../../../translation';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||||
|
|
||||||
describe('CardViewDateItemComponent', () => {
|
describe('CardViewDateItemComponent', () => {
|
||||||
let loader: HarnessLoader;
|
let loader: HarnessLoader;
|
||||||
@@ -38,7 +45,16 @@ describe('CardViewDateItemComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot(), CoreTestingModule]
|
imports: [
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
NoopAnimationsModule,
|
||||||
|
HttpClientTestingModule,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatDatepickerModule,
|
||||||
|
MatDialogModule,
|
||||||
|
MatTooltipModule
|
||||||
|
],
|
||||||
|
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }]
|
||||||
});
|
});
|
||||||
appConfigService = TestBed.inject(AppConfigService);
|
appConfigService = TestBed.inject(AppConfigService);
|
||||||
appConfigService.config.dateValues = {
|
appConfigService.config.dateValues = {
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { IdentityGroupService } from './identity-group.service';
|
import { IdentityGroupService } from './identity-group.service';
|
||||||
import {
|
import {
|
||||||
mockHttpErrorResponse,
|
mockHttpErrorResponse,
|
||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
} from '../mock/identity-group.service.mock';
|
} from '../mock/identity-group.service.mock';
|
||||||
import { mockFoodGroups } from '../mock/group-cloud.mock';
|
import { mockFoodGroups } from '../mock/group-cloud.mock';
|
||||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||||
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
describe('IdentityGroupService', () => {
|
describe('IdentityGroupService', () => {
|
||||||
let service: IdentityGroupService;
|
let service: IdentityGroupService;
|
||||||
@@ -34,7 +35,8 @@ describe('IdentityGroupService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ProcessServiceCloudTestingModule]
|
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||||
|
providers: [IdentityGroupService]
|
||||||
});
|
});
|
||||||
service = TestBed.inject(IdentityGroupService);
|
service = TestBed.inject(IdentityGroupService);
|
||||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||||
|
Reference in New Issue
Block a user