@mimik/test-helper
v2.2.4
Published
Used for encapsulting user, token and fixture creation process while testing mimik microservices
Downloads
59
Readme
test-helper
Example
const testHelper = require('@mimik/test-helper');
test-helper~runTests(conf, tests) ⇒ null
Run all tests using test-helper
Kind: inner method of test-helper
Category: async
| Param | Type | Description | | --- | --- | --- | | conf | string | Config to setup test helper to run test | | tests | function | Function containing mocha tests to run after and if test-helper is initialized successfully |
Example
conf: {
fixtures: {}, // All fixtures values
serviceConfiguration: file, // ./configuration/config.js
services: [
MID: 'mID'
]
users: [{ // Array of users to be created for the test
userKey, // This is going to be stored in the test to identify user in userHelper
email, // Email of user
password, // Password of user
}]
}
test-helper~importTest(name, testFilePath, perpFilePath) ⇒ null
Import test scripts from other files to run using test-helper
Kind: inner method of test-helper
Returns: null - perpFilePath: This file can have loadReal, unloadReal, loadMock and unloadMock methods. 'load' and 'unload' methods run before and after the test respectively
Category: async
| Param | Type | Description | | --- | --- | --- | | name | string | Name of the test to run | | testFilePath | string | Absolute file path of test scripts to be ran | | perpFilePath | string | (optional) Absolute file path of prep scripts to be ran before and after the test |