mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
AAE-30882 Replace superagent (#11134)
* [AAE-30878] - Migrating from event-emitter to eventemitter3 which is ESM and commonJs compatibile * [AAE-30878] - Using types to avoid compilation isues with the new ruels * AAE-30878 - fixed lint issue on js-api * AAE-30878 - reverted misplaced changes * [AAE-30882] - migrating from superagent to axios * AAE-30882 - Fixed unit test for js-api * AAE-30882 - Fixed unit test for js-api * AAE-30882 - Fixed unit test for js-api * AAE-30882 - Improved some unit tests * [ci:force] * AAE-30882 - Checking why is ok locally but fails on CI * AAE-30882 - Start fixing some unit tests - check 1 * AAE-30882 - Start fixing some unit tests - check 2 * [AAE-30882] - rebased * [AAE-30882] - added missing import
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
const fakeReportList = [
|
||||
@@ -154,58 +153,56 @@ const fakeProcessDefinitionsNoApp: any[] = [
|
||||
|
||||
export class ReportsMock extends BaseMock {
|
||||
get200ResponseCreateDefaultReport(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).post('/activiti-app/app/rest/reporting/default-reports').reply(200);
|
||||
this.createNockWithCors().post('/activiti-app/app/rest/reporting/default-reports').reply(200);
|
||||
}
|
||||
|
||||
get200ResponseTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.get('/activiti-app/app/rest/reporting/report-params/' + reportId + '/tasks')
|
||||
.query({ processDefinitionId })
|
||||
.reply(200, ['Fake Task 1', 'Fake Task 2', 'Fake Task 3']);
|
||||
}
|
||||
|
||||
get200ResponseReportList(): void {
|
||||
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/rest/reporting/reports').reply(200, fakeReportList);
|
||||
this.createNockWithCors().get('/activiti-app/app/rest/reporting/reports').reply(200, fakeReportList);
|
||||
}
|
||||
|
||||
get200ResponseReportParams(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.get('/activiti-app/app/rest/reporting/report-params/' + reportId)
|
||||
.reply(200, fakeReportParams);
|
||||
}
|
||||
|
||||
get200ResponseReportsByParams(reportId: string, paramsQuery: { status: string }): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/activiti-app/app/rest/reporting/report-params/' + reportId, paramsQuery)
|
||||
.reply(200, fakeChartReports);
|
||||
}
|
||||
|
||||
get200ResponseProcessDefinitions(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get('/activiti-app/app/rest/reporting/process-definitions')
|
||||
.reply(200, fakeProcessDefinitionsNoApp);
|
||||
this.createNockWithCors().get('/activiti-app/app/rest/reporting/process-definitions').reply(200, fakeProcessDefinitionsNoApp);
|
||||
}
|
||||
|
||||
get200ResponseUpdateReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.put('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200ResponseExportReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/activiti-app/app/rest/reporting/reports/' + reportId + '/export-to-csv')
|
||||
.reply(200, 'CSV');
|
||||
}
|
||||
|
||||
get200ResponseSaveReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
|
||||
get200ResponseDeleteReport(reportId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.delete('/activiti-app/app/rest/reporting/reports/' + reportId)
|
||||
.reply(200);
|
||||
}
|
||||
|
Reference in New Issue
Block a user