Skip to content

Commit

Permalink
test: cover is enum validation constraint in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 1, 2023
1 parent 040c6b9 commit 55bb8a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion test/type-helpers/fixtures/create-user-dto.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Expose, Transform } from 'class-transformer';
import { IsString } from 'class-validator';
import { IsEnum, IsString } from 'class-validator';
import { ApiProperty } from '../../../lib/decorators';
import { METADATA_FACTORY_NAME } from '../../../lib/plugin/plugin-constants';

Expand All @@ -10,6 +10,9 @@ export class CreateUserDto {
@IsString()
lastName: string;

@IsEnum(['admin', 'user'])
role: string;

@ApiProperty({ required: true })
login: string;

Expand Down
3 changes: 3 additions & 0 deletions test/type-helpers/fixtures/serialized-metadata.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const SERIALIZED_METADATA = {
CreateUserDto: {
active: {
type: () => Boolean
},
role: {
type: () => String
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/type-helpers/omit-type.helper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ describe('OmitType', () => {
expect(modelPropertiesAccessor.getModelProperties(prototype)).toEqual([
'password',
'firstName',
'active'
'active',
'role'
]);
});
});
Expand Down
3 changes: 2 additions & 1 deletion test/type-helpers/partial-type.helper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ describe('PartialType', () => {
'password',
'firstName',
'lastName',
'active'
'active',
'role'
]);
});

Expand Down

0 comments on commit 55bb8a7

Please sign in to comment.