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

@@ -20,7 +20,19 @@ import { BaseMock } from '../base.mock';
export class UploadMock extends BaseMock {
get201CreationFile(): void {
nock(this.host, { encodedQueryParams: true })
nock(this.host).persist().options(/.*/).reply(200, '', {
'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',
'Access-Control-Allow-Credentials': 'true'
});
// Handle POST request with any query parameters
nock(this.host)
.defaultReplyHeaders({
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': 'true'
})
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
.reply(201, {
entry: {
@@ -47,7 +59,7 @@ export class UploadMock extends BaseMock {
}
get201CreationFileAutoRename(): void {
nock(this.host, { encodedQueryParams: true })
this.createNockWithCors()
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
.query({ autoRename: 'true' })
.reply(201, {
@@ -75,7 +87,7 @@ export class UploadMock extends BaseMock {
}
get409CreationFileNewNameClashes(): void {
nock(this.host, { encodedQueryParams: true })
this.createNockWithCors()
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
.reply(409, {
error: {
@@ -89,7 +101,7 @@ export class UploadMock extends BaseMock {
}
get401Response(): void {
nock(this.host, { encodedQueryParams: true })
this.createNockWithCors()
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
.reply(401, {
error: {