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

Integer failure error can be improved #31

Open
arichiardi opened this issue Jun 12, 2017 · 2 comments
Open

Integer failure error can be improved #31

arichiardi opened this issue Jun 12, 2017 · 2 comments
Labels

Comments

@arichiardi
Copy link
Collaborator

Hello again, just logging here a potential improvement of the error message for s.spec.number.

I have:

const school = s.spec.map("schoolSpec", {
   city: s.string
});
const friend = s.spec.map("friendSpec", {
   name: s.spec.string,
   age: s.spec.number,
   school
});

and (using the new js-spec-chai:

it("test", () => {
  const obj = {
    name: "andrea",
    age: "18",
    school: {
      city: "Turin",
    }
  };
  obj.should.conform(friend);
})

I receive AssertionError: friendSpec → i: i failed for 18 at [age]. which could be improved to AssertionError: friendSpec → age: s.spec.number failed for 18 at [age]. for instance.

@prayerslayer
Copy link
Owner

Interesting, I was under the impression it should read one of isInteger, int or integer instead of i. Looks like I should test my getName properly 😅

Thanks for reporting!

@mattbishop
Copy link
Contributor

How about this error message @arichiardi? Doesn't PR #54 fix this one too?

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

No branches or pull requests

3 participants