Passwordless-TokenStore-Test
This module provides generic tests for the implementation of custom TokenStores for Passwordless, a node.js module for express that allows website authentication without password using verification through email or other means.
Usage
In the folder of your custom TokenStore implementation do:
$ npm install passwordless-tokenstore-test --save-dev
Afterwards, you can simply call the test suite as part of your other tests. For example:
var standardTests = ; { return ;} var { // clean database before usage ;} var { // any other activity after each test ;} // Call the test suite;
Parameter
The exported function has to be called with the following parameter:
;
- TokenStoreFactory: has to provide a fresh instance of your TokenStore with each call
- beforeEachTest: will be called before each test of the standard test suite. Please make sure that you call done()
- afterEachTest: will be called after each test of the standard test suite. Please make sure that you call done()
- timeout (defaults to 200ms): The expected time it takes to store the data in the database in a typical test environment. A higher value will slow down your tests, but a too low value might result in failed tests due to data that is not yet written
All parameters are mandatory.
The test suite expects a clean state of the TokenStore (incl. the underlying database) for each test. You may use beforeEachTest to clean the state of the database.
License
Author
Florian Heinemann @thesumofall