AAE-30882 Remove superagent for fetch (#11856)

* [AAE-30882] - Remove superagent for fetch

* [AAE-30882] - Fixing comments

* [AAE-30882] - fixde failing unit tests

* [AAE-30882] - fixde failing unit tests

* [AAE-30882] - fixd sonarcloud comment
This commit is contained in:
Vito Albano
2026-05-07 09:12:07 +01:00
committed by GitHub
parent 9cdacf3ebf
commit 57bf066164
54 changed files with 2127 additions and 922 deletions
@@ -16,42 +16,34 @@
*/
import { BaseMock } from '../base.mock';
import nock from 'nock';
import { FilePlanRolePaging } from '@alfresco/js-api';
export class FilePlansMock extends BaseMock {
get200FilePlanRoles(filePlanId: string): void {
this.nock200FilePlanRoles(filePlanId).query({}).reply(200, this.mockFilePlanRolePaging());
this.mock().get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`).reply(200, this.mockFilePlanRolePaging());
}
get200FilePlanRolesWithFilteringByCapabilityNames(filePlanId: string): void {
this.nock200FilePlanRoles(filePlanId)
.query({
where: "(capabilityName in ('capability1', 'capability2'))"
})
this.mock()
.get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`)
.query({ where: "(capabilityName in ('capability1', 'capability2'))" })
.reply(200, this.mockFilePlanRolePaging());
}
get200FilePlanRolesWithFilteringByPersonId(filePlanId: string): void {
this.nock200FilePlanRoles(filePlanId)
.query({
where: "(personId='someUser')"
})
this.mock()
.get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`)
.query({ where: "(personId='someUser')" })
.reply(200, this.mockFilePlanRolePaging());
}
get200FilePlanRolesWithFilteringByPersonIdAndCapabilityNames(filePlanId: string): void {
this.nock200FilePlanRoles(filePlanId)
.query({
where: "(personId='someUser' and capabilityName in ('capability1', 'capability2'))"
})
this.mock()
.get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`)
.query({ where: "(personId='someUser' and capabilityName in ('capability1', 'capability2'))" })
.reply(200, this.mockFilePlanRolePaging());
}
private nock200FilePlanRoles(filePlanId: string): nock.Interceptor {
return nock(this.host, { encodedQueryParams: true }).get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`);
}
private mockFilePlanRolePaging(): FilePlanRolePaging {
return {
list: {