diff --git a/apps/server/src/modules/deletion/controller/dto/deletion-execution.params.spec.ts b/apps/server/src/modules/deletion/controller/dto/deletion-execution.params.spec.ts new file mode 100644 index 00000000000..c915276e97b --- /dev/null +++ b/apps/server/src/modules/deletion/controller/dto/deletion-execution.params.spec.ts @@ -0,0 +1,38 @@ +import { DeletionExecutionParams } from './deletion-execution.params'; + +describe(DeletionExecutionParams.name, () => { + describe('constructor', () => { + describe('when passed properties', () => { + let deletionExecutionParams: DeletionExecutionParams; + + beforeEach(() => { + deletionExecutionParams = new DeletionExecutionParams(); + }); + + it('should be defined', () => { + expect(deletionExecutionParams).toBeDefined(); + }); + + it('should have a limit property', () => { + expect(deletionExecutionParams.limit).toBeDefined(); + }); + + it('limit should be a number with a default value of 100', () => { + expect(deletionExecutionParams.limit).toBeDefined(); + expect(typeof deletionExecutionParams.limit).toBe('number'); + expect(deletionExecutionParams.limit).toBe(100); + }); + + it('limit should be optional', () => { + deletionExecutionParams.limit = undefined; + expect(deletionExecutionParams.limit).toBeUndefined(); + }); + + it('limit should be a number when provided', () => { + const customLimit = 50; + deletionExecutionParams.limit = customLimit; + expect(deletionExecutionParams.limit).toBe(customLimit); + }); + }); + }); +}); diff --git a/apps/server/src/modules/deletion/controller/dto/deletion-request.body.params.spec.ts b/apps/server/src/modules/deletion/controller/dto/deletion-request.body.params.spec.ts new file mode 100644 index 00000000000..8aa63cc5e60 --- /dev/null +++ b/apps/server/src/modules/deletion/controller/dto/deletion-request.body.params.spec.ts @@ -0,0 +1,34 @@ +import { DeletionRequestBodyProps } from './deletion-request.body.params'; + +describe(DeletionRequestBodyProps.name, () => { + describe('constructor', () => { + describe('when passed properties', () => { + let deletionRequestBodyProps: DeletionRequestBodyProps; + + beforeEach(() => { + deletionRequestBodyProps = new DeletionRequestBodyProps(); + }); + + it('should be defined', () => { + expect(deletionRequestBodyProps).toBeDefined(); + }); + + it('deleteInMinutes should be a number with default value 43200', () => { + expect(deletionRequestBodyProps.deleteInMinutes).toBeDefined(); + expect(typeof deletionRequestBodyProps.deleteInMinutes).toBe('number'); + expect(deletionRequestBodyProps.deleteInMinutes).toBe(43200); + }); + + it('deleteInMinutes should be optional', () => { + deletionRequestBodyProps.deleteInMinutes = undefined; + expect(deletionRequestBodyProps.deleteInMinutes).toBeUndefined(); + }); + + it('deleteInMinutes should be a number when provided', () => { + const customDeleteInMinutes = 60; + deletionRequestBodyProps.deleteInMinutes = customDeleteInMinutes; + expect(deletionRequestBodyProps.deleteInMinutes).toBe(customDeleteInMinutes); + }); + }); + }); +}); diff --git a/apps/server/src/modules/deletion/uc/builder/deletion-request-body-props.builder.ts b/apps/server/src/modules/deletion/uc/builder/deletion-request-body-props.builder.ts index 8d5e60bb19d..77ade83b917 100644 --- a/apps/server/src/modules/deletion/uc/builder/deletion-request-body-props.builder.ts +++ b/apps/server/src/modules/deletion/uc/builder/deletion-request-body-props.builder.ts @@ -3,7 +3,7 @@ import { DeletionDomainModel } from '../../domain/types/deletion-domain-model.en import { DeletionRequestBodyProps } from '../../controller/dto'; export class DeletionRequestBodyPropsBuilder { - static build(domain: DeletionDomainModel, id: EntityId, deleteInMinutes: number): DeletionRequestBodyProps { + static build(domain: DeletionDomainModel, id: EntityId, deleteInMinutes?: number): DeletionRequestBodyProps { const deletionRequest = { targetRef: { domain, id }, deleteInMinutes,