Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in async cast #7

Open
nathandem opened this issue Apr 11, 2020 · 0 comments
Open

Bug in async cast #7

nathandem opened this issue Apr 11, 2020 · 0 comments

Comments

@nathandem
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant