mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
test: update corresponding tests
This commit is contained in:
@@ -27,8 +27,8 @@ describe('ParseEnumPipe', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should not throw an error if "enumType" is undefined/null and isOptional is true', async () => {
|
||||
const target = new ParseEnumPipe(null, { isOptional: true });
|
||||
it('should not throw an error if enumType is undefined/null and isOptional is true', async () => {
|
||||
const target = new ParseEnumPipe('DOWN', { optional: true });
|
||||
const value = await target.transform(undefined, {} as ArgumentMetadata);
|
||||
expect(value).to.equal(undefined);
|
||||
});
|
||||
@@ -51,14 +51,5 @@ describe('ParseEnumPipe', () => {
|
||||
);
|
||||
}
|
||||
});
|
||||
it('should throw an error if "enumType" is undefined/null and isOptional false', async () => {
|
||||
try {
|
||||
new ParseEnumPipe(null, { isOptional: false });
|
||||
} catch (err) {
|
||||
expect(err.message).to.equal(
|
||||
`"ParseEnumPipe" requires "enumType" argument specified (to validate input values).`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user