1.0.0 • Published 10 years ago
daspec-quantity-matchers v1.0.0
Quantity units matchers for DaSpec, allowing you to compare quantities using different units, with the help of the excellent JS-Quantities library.
Examples
expect(actualLength).quantityToEqual('10km')
expect(actualArea).quantityToBeLessThan('10m^2')
expect(actualWeight).quantityToBeGreaterThan('3kg')
expect(actualSpeed).quantityToBeLessThan('10 m/s')
expect(actualHeight).quantityToBeGreaterThanOrEqual('10 ft')Installation
Install the quantity matchers using NPM:
npm install daspec-quantity-matchers --save-devAdd the daspec-quantity-matchers to the --matchers argument when you run daspec from the command line:
daspec --specs ... --steps ... --matchers daspec-quantity-matchersAlternatively, set the matchers key in your daspec.json config file:
{
...
"matchers": [... , "daspec-quantity-matchers"],
...
}To see these matchers in action, see the DaSpec NPM Example project.
For an explanation of the syntax for defining custom matchers, see Custom Matchers in the DaSpec guide.
For more information on configuring the DaSpec Node runner, see http://daspec.com/guides/install.html
1.0.0
10 years ago