examples from should.js docs:
var user =name: 'tj'pets: 'tobi' 'loki' 'jane' 'bandit';usershouldhaveproperty'name' 'tj';usershouldhaveproperty'pets'withlengthOf4;
T usernameEQ username 'tj'EQ userpetslength 4
how about from expect.js:
T typeof windowr == 'undefined'T typeof 5 == 'number'T ArrayisArray
Don't even get me started on Node.js assert.
Terst has three main advantages:
- There are only six methods to remember. You aren't second guessing what each method really does or constantly referring to the documentation.
- Your eyes can quickly scan down the left side of your tests to quickly interpret what each test should do. Terst forces you to be very explicit.
- It's very lightweight.
npm install --save terst
component install jprichardson/terst
Asserts if the value is truthy.
Asserts if the value is falsey.
val1 strictly equals
val does not strictly equal
Asserts if the value is within +- the delta.
Asserts if a function throws i.e. if it does not throw, there is an error.
NOTE: For descriptive errors, you can set
terse.autoMsg = true. It's experimental only.
Copyright 2013-2014, JP Richardson firstname.lastname@example.org