Skip to content

Integer failure error can be improved #31

@arichiardi

Description

@arichiardi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions