AAE-30882 - Fixed unit test for js-api

This commit is contained in:
VitoAlbano
2025-08-22 12:48:30 +01:00
committed by Vito Albano
parent e400bc1068
commit c17c8232af
43 changed files with 575 additions and 460 deletions

View File

@@ -29,7 +29,15 @@ export class BpmAuthMock extends BaseMock {
}
get200Response(): void {
this.addCorsSupport();
nock(this.host, { encodedQueryParams: true })
.defaultReplyHeaders({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization, Content-Length, X-Requested-With, Cache-Control, X-CSRF-TOKEN',
'Access-Control-Allow-Credentials': 'true',
'Set-Cookie': 'ACTIVITI_REMEMBER_ME=NjdOdGwvcUtFTkVEczQyMGh4WFp5QT09OmpUL1UwdFVBTC94QTJMTFFUVFgvdFE9PQ; Path=/; HttpOnly'
})
.post(
'/activiti-app/app/authentication',
'j_username=' + this.username + '&j_password=' + this.password + '&_spring_security_remember_me=true&submit=Login'
@@ -38,11 +46,11 @@ export class BpmAuthMock extends BaseMock {
}
get200ResponseLogout(): void {
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/logout', {}).reply(200);
this.createNockWithCors().get('/activiti-app/app/logout').reply(200);
}
get401Response(): void {
nock(this.host, { encodedQueryParams: true })
this.createNockWithCors()
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
.reply(401, {
error: {
@@ -53,7 +61,7 @@ export class BpmAuthMock extends BaseMock {
}
get403Response(): void {
nock(this.host, { encodedQueryParams: true })
this.createNockWithCors()
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
.reply(403, {
error: {