wingbot 3.31.5 → 3.31.6
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 +1 -1
- package/src/BuildRouter.js +4 -2
- package/src/ConversationTester.js +1 -1
- package/src/Tester.js +19 -5
package/package.json
CHANGED
package/src/BuildRouter.js
CHANGED
|
@@ -310,7 +310,8 @@ class BuildRouter extends Router {
|
|
|
310
310
|
this._configTs = 0;
|
|
311
311
|
}
|
|
312
312
|
if (this._prebuiltGlobalIntents !== null) {
|
|
313
|
-
this.globalIntents
|
|
313
|
+
this.globalIntents.clear();
|
|
314
|
+
this._prebuiltGlobalIntents.forEach(([k, v]) => this.globalIntents.set(k, v));
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
|
|
@@ -326,7 +327,8 @@ class BuildRouter extends Router {
|
|
|
326
327
|
if (this._prebuiltGlobalIntents === null) {
|
|
327
328
|
this._prebuiltGlobalIntents = Array.from(this.globalIntents.entries());
|
|
328
329
|
} else {
|
|
329
|
-
this.globalIntents
|
|
330
|
+
this.globalIntents.clear();
|
|
331
|
+
this._prebuiltGlobalIntents.forEach(([k, v]) => this.globalIntents.set(k, v));
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
if (this._prebuiltRoutesCount === null) {
|
package/src/Tester.js
CHANGED
|
@@ -70,8 +70,15 @@ class Tester {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
this._listener = (senderIdentifier, action, text, req, prevAction, doNotTrack) => {
|
|
73
|
+
const reqAction = req.action();
|
|
74
|
+
if (reqAction && !this._actionMatches(action, reqAction)) {
|
|
75
|
+
this._actionsCollector.push({
|
|
76
|
+
action: reqAction, text, prevAction, doNotTrack, isReqAction: true
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
73
80
|
this._actionsCollector.push({
|
|
74
|
-
action, text, prevAction, doNotTrack
|
|
81
|
+
action, text, prevAction, doNotTrack, isReqAction: false
|
|
75
82
|
});
|
|
76
83
|
};
|
|
77
84
|
|
|
@@ -255,18 +262,25 @@ class Tester {
|
|
|
255
262
|
return new ResponseAssert(this.responses[this.responses.length - 1]);
|
|
256
263
|
}
|
|
257
264
|
|
|
265
|
+
_actionMatches (botAction, path) {
|
|
266
|
+
return botAction === path
|
|
267
|
+
|| (path === '*' && botAction === '/*')
|
|
268
|
+
|| (!botAction.match(/\*/) && actionMatches(botAction, path));
|
|
269
|
+
}
|
|
270
|
+
|
|
258
271
|
/**
|
|
259
|
-
* Checks, that
|
|
272
|
+
* Checks, that request passed an interaction
|
|
260
273
|
*
|
|
261
274
|
* @param {string} path
|
|
275
|
+
* @param {boolean} [matchRequestActions]
|
|
262
276
|
* @returns {this}
|
|
263
277
|
*
|
|
264
278
|
* @memberOf Tester
|
|
265
279
|
*/
|
|
266
|
-
passedAction (path) {
|
|
280
|
+
passedAction (path, matchRequestActions = false) {
|
|
267
281
|
const ok = this.actions
|
|
268
|
-
.some((action) => (action.
|
|
269
|
-
|
|
282
|
+
.some((action) => (!action.isReqAction || matchRequestActions)
|
|
283
|
+
&& this._actionMatches(action.action, path));
|
|
270
284
|
let actual;
|
|
271
285
|
if (!ok) {
|
|
272
286
|
const set = new Set();
|