vlid
vlid copied to clipboard
Bug in async cast
First off, thank you for this nice, lightweight library! It's a nice replacement to the heavy joi without losing the "80%" as you put it :)
I noticed an issue around number casting when using validate
, while it's still working fine with validateSync
.
I confirmed this by adding this small test in __tests__/numbers.js
:
it('should cast strings with numbers in them to numbers (async)', async () => {
let result = await v.validate(v.number().cast(), '1');
isValidWithoutErrors(result);
expect(result.value).toBe(1);
});
It failed.
I don't know how you want to approach this, but I feel like it would be good to have some tests with validate
. Probably not a duplicate of every existing synchronous tests, but a few "integration" tests with more complex payloads like this one.