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:
@@ -395,24 +395,37 @@ describe('AnalyticsReportParametersComponent', () => {
|
||||
beforeEach(async () => {
|
||||
const reportId = 1;
|
||||
const change = new SimpleChange(null, reportId, true);
|
||||
component.ngOnChanges({ reportId: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
// Set up the mock response before triggering the change
|
||||
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
||||
status: 200,
|
||||
contentType: 'json',
|
||||
responseText: analyticParamsMock.reportDefParamStatus
|
||||
});
|
||||
|
||||
component.ngOnChanges({ reportId: change });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
// Ensure the component has processed the report parameters
|
||||
component.toggleParameters();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
});
|
||||
|
||||
it('Should be able to change the report title', async () => {
|
||||
spyOn(service, 'updateReport').and.returnValue(of(analyticParamsMock.reportDefParamStatus));
|
||||
|
||||
// Trigger change detection like the other working tests do
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
// Wait for the component to be properly initialized from the beforeEach
|
||||
expect(component.reportParameters).toBeDefined();
|
||||
expect(component.reportParameters.name).toBe('Fake Task overview status');
|
||||
|
||||
const title = element.querySelector<HTMLElement>('h4');
|
||||
expect(title).not.toBeNull();
|
||||
title.click();
|
||||
fixture.detectChanges();
|
||||
|
||||
|
Reference in New Issue
Block a user