Test Helper Lib
- Source:
Example
const testLib = require('clout-js/test/lib');
let clout = testLib.createInstance('./');
clout.on('started', () => {
console.log(testLib.serverAddress);
testLib.request({uri: '/api/test', method: 'get', json: true})
.then((response) => console.log(response.body));
});
Members
(static) config
Properties:
Name | Type | Description |
---|---|---|
applicationDir |
string
|
default clout-js application |
serverAddress |
string
|
http address for clout-js instance |
- Source:
Methods
(static) createhttpUrl(path) → {string}
generates url for APIs
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
string
|
Returns:
- Type:
-
string
(static) createInstance(applicationDirnullable) → {objet}
create clout-js instance application directory
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
applicationDir |
string
|
<nullable> |
Returns:
- Type:
-
objet
clout-js instance
(static) request(args) → {promise}
wrapps request in promise and replaces urls with clout-js instance
- Source:
Parameters:
Name | Type | Description |
---|---|---|
args |
array
|
Returns:
- Type:
-
promise