generate-by-validation
Generate data based on validation. we can generate valid data and invalid data so we can use it for our functional test activity
I'm using https://github.com/fent/randexp.js to generate the data
Installation
npm install generate-by-validation
Usage
First include the module to your project
var data = ;
For example you want generate name with minimal length = 5 and maximal length = 10
var name = dataconsole//will output something like : 'SnDueGq-IG' =>length beetwen 5-10
If you want generate data which not match with name, min:5, and max:10 you can set second parameter to false
var name = dataconsole//will output something like : '/,!/"474]5{$*\'/6~,8\'\'*%}!' => length more than 10
The result is random that's why the result ussually unpronounceable
Supported validation rule
- alpha : a-z
- min:x
- max:y
- between:x,y
- exact:x