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: nested async rules #161

Closed
havelaer opened this issue Sep 7, 2019 · 1 comment
Closed

Bug: nested async rules #161

havelaer opened this issue Sep 7, 2019 · 1 comment

Comments

@havelaer
Copy link
Contributor

havelaer commented Sep 7, 2019

Async rules are not tested async when placed within a schema.

  test("nested async rule", async () => {
    v8n.extend({ asyncRule });

    const validation = v8n().schema({
      item: v8n().number().asyncRule([10, 17, 20]),
    });

    await expect(validation.testAsync({ item: "10" })).rejects.toBeDefined();
    await expect(validation.testAsync({ item: 11 })).rejects.toBeDefined(); // -> expect failes, because asyncRule is not validated async.
    await expect(validation.testAsync({ item: 17 })).resolves.toBe({ item: 17 });
  });
@imbrn
Copy link
Owner

imbrn commented Sep 7, 2019

Thank you @havelaer for your report, I'll check this.

@imbrn imbrn closed this as completed Sep 15, 2019
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

2 participants