mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
style: minor tweaks
This commit is contained in:
@@ -14,17 +14,11 @@ describe('ParseEnumPipe', () => {
|
||||
Up = 'UP',
|
||||
}
|
||||
let target: ParseEnumPipe;
|
||||
let tatargetWithOptionIsTrue: ParseEnumPipe;
|
||||
|
||||
beforeEach(() => {
|
||||
target = new ParseEnumPipe(Direction, {
|
||||
exceptionFactory: (error: any) => new CustomTestError(),
|
||||
});
|
||||
|
||||
tatargetWithOptionIsTrue = new ParseEnumPipe(Direction, {
|
||||
exceptionFactory: (error: any) => new CustomTestError(),
|
||||
optional: true,
|
||||
});
|
||||
});
|
||||
describe('transform', () => {
|
||||
describe('when validation passes', () => {
|
||||
@@ -47,9 +41,13 @@ describe('ParseEnumPipe', () => {
|
||||
).to.be.rejectedWith(CustomTestError);
|
||||
});
|
||||
|
||||
it('should throw an error if enumType is wrong even optional is true', async () => {
|
||||
it('should throw an error if enumType is wrong and optional is true', async () => {
|
||||
target = new ParseEnumPipe(Direction, {
|
||||
exceptionFactory: (error: any) => new CustomTestError(),
|
||||
optional: true,
|
||||
});
|
||||
return expect(
|
||||
tatargetWithOptionIsTrue.transform('DOWN', {} as ArgumentMetadata),
|
||||
target.transform('DOWN', {} as ArgumentMetadata),
|
||||
).to.be.rejectedWith(CustomTestError);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user