-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for executionParams and requestbodyParams
- Loading branch information
1 parent
9ea749f
commit 46c98b2
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
apps/server/src/modules/deletion/controller/dto/deletion-execution.params.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
apps/server/src/modules/deletion/controller/dto/deletion-request.body.params.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters