tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 194 forks source link

max, min, email and url #98

Closed paixaop closed 11 years ago

paixaop commented 11 years ago

Hi I added validators for min, max, email and url min (>=) and max (<=) work like above and bellow, but are inclusive of the given number.

email test for RFC822 address url tests for valid URLs

hope you can merge these back in.

faridnsh commented 11 years ago

Use regex.test instead of exec.

btd commented 11 years ago

As Tj already said, min/max already available but with another names. I do not think specific regexps should be in should.js - at least while it is testing library.

paixaop commented 11 years ago

BTD I agree with you, not having specific regexps in a testing library, but some regexps like email validity testing are very common, and are really easy to get wrong. The likely outcome of each user writing their own regexp to test the validity of an email address is a lot of bugs.

btd commented 11 years ago

You can every time create a plugin for should.js. Just extend Assertion.prototype and require where you need it.