wingbot 3.37.0 → 3.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -69,11 +69,15 @@ const DEFAULT_TEXT_THRESHOLD = 0.8;
|
|
|
69
69
|
* @prop {List[]} lists
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
+
/** @typedef {import('./ReducerWrapper')} ReducerWrapper */
|
|
73
|
+
/** @typedef {import('./Router')} Router */
|
|
74
|
+
/** @typedef {import('./BuildRouter')} BuildRouter */
|
|
75
|
+
|
|
72
76
|
/**
|
|
73
77
|
* Callback for getting a tester
|
|
74
78
|
*
|
|
75
79
|
* @callback testerFactory
|
|
76
|
-
* @param {Router|ReducerWrapper} bot - the chatbot itself
|
|
80
|
+
* @param {Router|ReducerWrapper|BuildRouter} bot - the chatbot itself
|
|
77
81
|
* @param {TestsGroup} test - the chatbot itself
|
|
78
82
|
* @returns {Tester}
|
|
79
83
|
*/
|
|
@@ -90,6 +94,12 @@ const DEFAULT_TEXT_THRESHOLD = 0.8;
|
|
|
90
94
|
* @prop {number} stepCount
|
|
91
95
|
*/
|
|
92
96
|
|
|
97
|
+
/**
|
|
98
|
+
* @typedef {object} Logger
|
|
99
|
+
* @prop {Function} log
|
|
100
|
+
* @prop {Function} error
|
|
101
|
+
*/
|
|
102
|
+
|
|
93
103
|
/**
|
|
94
104
|
* Automated Conversation tests runner
|
|
95
105
|
*/
|
|
@@ -109,6 +119,7 @@ class ConversationTester {
|
|
|
109
119
|
* @param {number} [options.textCasesPerStep]
|
|
110
120
|
* @param {number} [options.textCaseParallel]
|
|
111
121
|
* @param {boolean} [options.allowEmptyResponse]
|
|
122
|
+
* @param {Logger} [options.log]
|
|
112
123
|
* @param {testerFactory} [options.testerFactory]
|
|
113
124
|
*/
|
|
114
125
|
constructor (testsSource, botFactory, options = {}) {
|
|
@@ -122,6 +133,7 @@ class ConversationTester {
|
|
|
122
133
|
};
|
|
123
134
|
this._output = '';
|
|
124
135
|
this._cachedBot = null;
|
|
136
|
+
this._log = options.log || console;
|
|
125
137
|
}
|
|
126
138
|
|
|
127
139
|
/**
|
|
@@ -159,18 +171,21 @@ class ConversationTester {
|
|
|
159
171
|
this._cachedBot = null;
|
|
160
172
|
}
|
|
161
173
|
this._output = '';
|
|
162
|
-
const testCases = await this._getTestCases(lang);
|
|
163
|
-
const groups = this._getGroups(testCases);
|
|
164
|
-
const testsGroups = this._getTestsGroups(groups, step);
|
|
165
|
-
const stepCount = Number.isInteger(step) ? groups.length : 1;
|
|
166
174
|
|
|
167
175
|
const botconfig = validationRequestBody;
|
|
168
176
|
let failed = 0;
|
|
169
177
|
let passed = 0;
|
|
170
178
|
let skipped = 0;
|
|
171
179
|
let summaryOutput = '';
|
|
180
|
+
let stepCount = 0;
|
|
181
|
+
let testsGroups = [];
|
|
172
182
|
|
|
173
183
|
try {
|
|
184
|
+
const testCases = await this._getTestCases(lang);
|
|
185
|
+
const groups = this._getGroups(testCases);
|
|
186
|
+
testsGroups = this._getTestsGroups(groups, step);
|
|
187
|
+
stepCount = Number.isInteger(step) ? groups.length : 1;
|
|
188
|
+
|
|
174
189
|
const results = [];
|
|
175
190
|
for (const testsGroup of testsGroups) {
|
|
176
191
|
let stepResult;
|
|
@@ -224,6 +239,7 @@ class ConversationTester {
|
|
|
224
239
|
}
|
|
225
240
|
|
|
226
241
|
} catch (e) {
|
|
242
|
+
this._log.error('#Tester failed', e, { output: this._output, passed });
|
|
227
243
|
this._output += `\nBot test failed: ${e.message}\n`;
|
|
228
244
|
}
|
|
229
245
|
return {
|
|
@@ -11,6 +11,8 @@ const ConversationTester = require('../ConversationTester');
|
|
|
11
11
|
* @prop {Function} getTestCases
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
/** @typedef {import('../ConversationTester').Logger} Logger */
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* Returns API for conversations testing
|
|
16
18
|
*
|
|
@@ -26,6 +28,8 @@ const ConversationTester = require('../ConversationTester');
|
|
|
26
28
|
* @param {number} [options.textCasesPerStep]
|
|
27
29
|
* @param {number} [options.textCaseParallel]
|
|
28
30
|
* @param {boolean} [options.allowEmptyResponse]
|
|
31
|
+
* @param {Logger} [options.log]
|
|
32
|
+
*
|
|
29
33
|
* @param {string[]|Function} [acl] - limit api to array of groups or use auth function
|
|
30
34
|
*/
|
|
31
35
|
function conversationTestApi (testsSource, botFactory, options, acl) {
|