assertify
Automatically generates chai
assertions.
For lazy developers that want to quickly write their unit tests.
Example
var assertify = ; // Given a variable you want to make assertions forvar store = id: '3605' name: 'Fnac Preciados' street: 'Calle Preciados, 28' zip: '28013' city: 'Madrid' latitude: 40419027 longitude: -3705254 openingTimes: date: 1439456166345 time: '08:00 - 20:00' today: true type: 'store' homeStore: false newStore: true; // Just assertify it; // The console will output:chaitobe;chaitohave;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitohavelength1;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;chaitobe;
Usage
assertify(variable, options)
Arguments
variable
- Anything you want to make assertions foroptions
- An optional object defining a number of options:variableName
- The variable name to render, by default'foo'
includeTypes
- Whether to include assertions to check the value type, by defaulttrue
console
- If truthy, willconsole.log
the chai assertions. Can also be a function in case you want custom logging. By defaultfalse
.