Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@ describe("JS Input Validator", function() {
};

it("should validate input data object against validation schema and return error object", function() {
// const errors = new Validator(schema).run(values);
// TODO: Fix
expect(true).to.equal(true);
const errors = new Validator(schema).run(values);

const expectedErrors = {
field1: [ 'Invalid data type!', 'Invalid character size! (max)' ],
field2: [ 'field 2 is required!' ],
field4: [ 'Invalid email address' ]
}

expect(errors.field1[0]).to.equal(expectedErrors.field1[0]);
expect(errors.field1[1]).to.equal(expectedErrors.field1[1]);
expect(errors.field2[0]).to.equal(expectedErrors.field2[0]);
expect(errors.field4[0]).to.equal(expectedErrors.field4[0]);
});
});
});
Expand Down