Debian Codegraph @

debian/tests/test_modules/abstract-winston-transport/index.js

raw
1 /**
2 * Winston TransportStream Abstract Test Suite
3 *
4 * @param {Object} opts Options for your test suite execution
5 * @param {String} opts.name Transport name.
6 * @param {TransportStream} opts.Transport Class to instantiate (new Transport).
7 * @param {Boolean} opts.query If true, will also include "Query" suite.
8 * @param {Boolean} opts.stream If true, will also include "Stream" suite.
9 * @param {Object} opts.construct Options to pass to the transport to instantiate.
10 * - If passed an object, it will be passed as is when calling `new Transport(options)`.
11 * - If passed a function it will be called before: `new Transport(options())`.
12 * - If parameter left empty defaults to {}.
13 */
14 module.exports = function (options) {
15 if (!options || !options.name || !options.Transport) {
16 throw new Error('name and Transport are required options');
17 }
18
19 var name = options.name;
20 describe(name + ' transport (abstract-winston-tranport)', function () {
21 require('./log')(options);
22 ['stream', 'query'].forEach(function (suite) {
23 if (options[suite]) {
24 require('./' + suite)(options);
25 }
26 });
27 });
28 };