Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading