0.8.0 • Published 7 years ago
@hume/utils-test v0.8.0
hume utils test
Some helpers shared among the tests.
Install
:coffee: Install Node.js v8 and then:
npm i @hume/utils-testUse
:pencil: You can visit the complete example in this tests.
const utilsTest = require('@hume/utils-test');
console.log('Version');
console.log(utilsTst.version);API
:eyes: Full specification.
version
The actual version of the library.
version(string) - Version number.
shoot
A wrapper for snap-shot-it'.
async throwsAsync(block, errRegex) -> null
Am async version of assert.throws.
block(function) - Piece of code (returning a promise) to be checked.errRegex(object) - Regular expresion to confirm the expected error.
request
A wrapper for supertest with some additions (see next points).
async request.login(creds, opts) -> res
To login in Loopback using supertest in an easy way.
creds(object) - User credentials:email(string) - Email of the user to create.password(string) - Password of the user to create.
opts(object) - Optional params:path(string) - Endpoint path. (default: '/api/users/login')
res(object) - The response with.id(string) - The new token.