From a27fa0a8003c761acecd358ca5ab00070cd7e1a0 Mon Sep 17 00:00:00 2001 From: "Vila,Jordi (IT EDP)" Date: Wed, 20 May 2026 09:16:57 +0200 Subject: [PATCH] Fix: deletion paramaters with specific value false where being filtered out before calling the API --- ...roject-components-screen.component.spec.ts | 43 +++++++++++++++++++ .../project-components-screen.component.ts | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/app/screens/project-components-screen/project-components-screen.component.spec.ts b/src/app/screens/project-components-screen/project-components-screen.component.spec.ts index 8ffb9cf..a866467 100644 --- a/src/app/screens/project-components-screen/project-components-screen.component.spec.ts +++ b/src/app/screens/project-components-screen/project-components-screen.component.spec.ts @@ -312,6 +312,49 @@ describe('ProjectComponentsScreenComponent', () => { } as AppShellNotification, 8000); }); + it('should not filter out incident params with boolean false value', () => { + component.projectComponents = [{ + name: 'test-component', + status: 'CREATED', + logo: 'http://example.com/logo.png', + url: 'http://example.com', + canDelete: true, + hasAutomatedDeletionWorkflow: false + } as ProjectComponent]; + const testComponent = { + name: 'test-component', + status: 'CREATED', + logo: 'http://example.com/logo.png', + url: 'http://example.com', + canDelete: true, + hasAutomatedDeletionWorkflow: false + } as ProjectComponent; + component.selectedProject = { projectKey: 'PROJECT_1', location: 'LOC_1' } as AppProject; + const mockResult = { + deploymentStatus: false, + changeNumber: 'CHG1234567', + reason: 'Test reason', + projectKey: 'PROJECT_1', + componentName: 'test-component' + }; + spyOn(component.dialog, 'open').and.returnValue({ + afterClosed: () => of(mockResult) + } as any); + + component.onRequestDeletionClicked(testComponent); + + const incidentParams: CreateIncidentParameter[] = [ + { name: 'is_deployed', type: 'boolean', value: false as Boolean }, + { name: 'change_number', type: 'string', value: 'CHG1234567' as String }, + { name: 'reason', type: 'string', value: 'Test reason' as String } + ]; + expect(provisionerServiceSpy.requestComponentDeletion).toHaveBeenCalledWith( + 'PROJECT_1', + 'test-component', + incidentParams + ); + }); + it('should show error toast when deletion request fails', () => { component.projectComponents = [{ name: 'test-component', diff --git a/src/app/screens/project-components-screen/project-components-screen.component.ts b/src/app/screens/project-components-screen/project-components-screen.component.ts index 41aa785..35340a2 100644 --- a/src/app/screens/project-components-screen/project-components-screen.component.ts +++ b/src/app/screens/project-components-screen/project-components-screen.component.ts @@ -171,7 +171,7 @@ export class ProjectComponentsScreenComponent implements OnInit, OnDestroy { type: 'string', value: result.reason as String // NOSONAR } - ].filter(p => p.value); // Filter by defined values, which are undefined when the simple dialog is called + ].filter(p => p.value != null); // Filter by defined values, which are undefined when the simple dialog is called /* eslint-enable @typescript-eslint/no-wrapper-object-types */ this.provisionerService.requestComponentDeletion( result.projectKey,