Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
add format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fleg committed Sep 19, 2016
1 parent 0b96b4d commit acaadbc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,18 @@ describe('format', function() {
jefferson.addFormat('hostname', /.*/);
}).to.throwError(/format `hostname` already exists/);
});

it('should add format', function() {
jefferson.addFormat('md5', /^[0-9a-f]{32}$/);
});

it('should be ok with added format', function() {
jefferson.validate({format: 'md5'}, 'deadbeefdeadbeefdeadbeefdeadbeef');
});

it('should throw error on error', function() {
expect(function() {
jefferson.validate({format: 'md5'}, 'haha');
}).to.throwError(/should match format "md5"/);
});
});

0 comments on commit acaadbc

Please sign in to comment.