I have been working with the yup
library for JavaScript data validation, but I am encountering unexpected behavior. Despite thoroughly reviewing their documentation, I cannot pinpoint where I am misusing their API. When I run the unit test below, it fails when I expect it to pass. Any suggestions on what might be causing this issue?
import { object, string } from 'yup';
test('validator', async () => {
let schema = object({
name: string(),
});
expect(await schema.isValid({ name: 123 })).toEqual(false);
});
I am using version
"yup": "^0.32.11"
I attempted to run this validation within a Jest unit test and it failed. I also looked into other validation methods in their API docs.