Skip to content

Commit bb381a4

Browse files
committed
tests: adding email and IsNotEmpty validations
1 parent 66c5cd1 commit bb381a4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/__resources__/testHelpers/standardDtoTests.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export function standardDtoTests(testParams: any, dataFactory: any, requestFacto
3838
})
3939
}
4040

41+
if (testParams['IsNotEmpty']) {
42+
test.each(testParams['IsNotEmpty'])('should return **Bad Request** if param is empty (%p)', async (p) => {
43+
set(requestData, p, '')
44+
45+
await actAssert(`${p} should not be empty`)
46+
})
47+
}
48+
4149
if (testParams['IsEnum']) {
4250
test.each(testParams['IsEnum'])(
4351
'should return **Bad Request** if param doesnt exist in the ENUM definition (%p)',
@@ -118,6 +126,14 @@ export function standardDtoTests(testParams: any, dataFactory: any, requestFacto
118126
})
119127
}
120128

129+
if (testParams['IsEmail']) {
130+
test.each(testParams['IsEmail'])('should return **Bad Request** if param is not an email (%p)', async (p) => {
131+
set(requestData, p, 'not_an_email')
132+
133+
await actAssert(`${p} must be an email`)
134+
})
135+
}
136+
121137
if (testParams['MaxLength']) {
122138
test.each(testParams['MaxLength'])(
123139
`should return **Bad Request** if param length exceeds MaxLenght: (%p) length > %i`,

0 commit comments

Comments
 (0)