@sprucelabs/spruce-conversation-plugin 49.0.39 → 49.0.42
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/build/__tests__/behavioral/CheckingHealth.test.js +23 -23
- package/build/__tests__/behavioral/KillingASkill.test.js +3 -3
- package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +17 -17
- package/build/__tests__/behavioral/RespondingToMessages.test.js +14 -14
- package/build/__tests__/behavioral/TestingAConversation.test.js +11 -11
- package/build/__tests__/implementation/ConversationCoordinator.test.js +41 -41
- package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +15 -15
- package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +4 -4
- package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +10 -10
- package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +7 -7
- package/build/__tests__/implementation/ScriptTester.test.js +39 -39
- package/build/__tests__/implementation/SuggesterUtil.test.js +17 -17
- package/build/__tests__/implementation/TopicLoader.test.js +15 -15
- package/build/__tests__/implementation/TopicScriptPlayer.test.js +78 -78
- package/build/__tests__/implementation/TopicSuggester.test.d.ts +1 -1
- package/build/__tests__/implementation/TopicSuggester.test.js +18 -18
- package/build/esm/__tests__/behavioral/CheckingHealth.test.js +1 -1
- package/build/esm/__tests__/behavioral/KillingASkill.test.js +1 -1
- package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +1 -1
- package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +1 -1
- package/build/esm/__tests__/behavioral/TestingAConversation.test.js +1 -1
- package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +1 -1
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +1 -1
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +1 -1
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +1 -1
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +1 -1
- package/build/esm/__tests__/implementation/ScriptTester.test.js +1 -1
- package/build/esm/__tests__/implementation/SuggesterUtil.test.js +1 -1
- package/build/esm/__tests__/implementation/TopicLoader.test.js +1 -1
- package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +1 -1
- package/build/esm/__tests__/implementation/TopicSuggester.test.d.ts +1 -1
- package/build/esm/__tests__/implementation/TopicSuggester.test.js +1 -1
- package/package.json +5 -5
|
@@ -9,15 +9,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const test_1 = require("@sprucelabs/test");
|
|
13
12
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
13
|
+
const test_utils_2 = require("@sprucelabs/test-utils");
|
|
14
14
|
const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
|
|
15
15
|
const TopicScriptPlayer_1 = require("../../topics/TopicScriptPlayer");
|
|
16
16
|
class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
17
17
|
static async throwsWhenRequiredOptionsNotSent() {
|
|
18
18
|
//@ts-ignore
|
|
19
|
-
const err =
|
|
20
|
-
|
|
19
|
+
const err = test_utils_1.assert.doesThrow(() => new TopicScriptPlayer_1.TopicScriptPlayer());
|
|
20
|
+
test_utils_2.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
21
21
|
parameters: ['script', 'sendMessageHandler', 'target.personId'],
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -33,9 +33,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
33
33
|
await this.sendMessage(player, {
|
|
34
34
|
body: 'how are you today?',
|
|
35
35
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
test_utils_1.assert.isLength(messages, 1);
|
|
37
|
+
test_utils_1.assert.isEqual(messages[0].body, 'It all started on a cold, dark night.');
|
|
38
|
+
test_utils_1.assert.isEqualDeep(messages[0].target.personId, '12345');
|
|
39
39
|
}
|
|
40
40
|
static async respondsToMessagesWithAllLinesInScript() {
|
|
41
41
|
const messages = [];
|
|
@@ -51,9 +51,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
51
51
|
await this.sendMessage(player, {
|
|
52
52
|
body: 'how are you today?',
|
|
53
53
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
test_utils_1.assert.isLength(messages, 2);
|
|
55
|
+
test_utils_1.assert.isEqual(messages[0].body, 'It all started on a cold, dark night.');
|
|
56
|
+
test_utils_1.assert.isEqual(messages[1].body, 'Before the sun went down');
|
|
57
57
|
}
|
|
58
58
|
static async multipleTextLinesWaitsForDelay() {
|
|
59
59
|
const messages = [];
|
|
@@ -70,11 +70,11 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
70
70
|
void this.sendMessage(player, {
|
|
71
71
|
body: 'how are you today?',
|
|
72
72
|
});
|
|
73
|
-
|
|
73
|
+
test_utils_1.assert.isLength(messages, 1);
|
|
74
74
|
await this.wait(100);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
test_utils_1.assert.isLength(messages, 2);
|
|
76
|
+
test_utils_1.assert.isEqual(messages[0].body, 'It all started on a cold, dark night.');
|
|
77
|
+
test_utils_1.assert.isEqual(messages[1].body, 'Before the sun went down');
|
|
78
78
|
}
|
|
79
79
|
static async restartsScriptNextMessage() {
|
|
80
80
|
const messages = [];
|
|
@@ -93,7 +93,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
93
93
|
await this.sendMessage(player, {
|
|
94
94
|
body: 'how are you today?',
|
|
95
95
|
});
|
|
96
|
-
|
|
96
|
+
test_utils_1.assert.isLength(messages, 4);
|
|
97
97
|
}
|
|
98
98
|
static async respondsWithRandomLine() {
|
|
99
99
|
const messages = [];
|
|
@@ -109,7 +109,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
109
109
|
body: 'how are you today?',
|
|
110
110
|
});
|
|
111
111
|
if (messages.length === 0) {
|
|
112
|
-
|
|
112
|
+
test_utils_1.assert.fail("Didn't send any message.");
|
|
113
113
|
}
|
|
114
114
|
//@ts-ignore
|
|
115
115
|
delete remaining[messages.pop().body];
|
|
@@ -130,10 +130,10 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
130
130
|
await this.sendMessage(player, {
|
|
131
131
|
body: 'What the?',
|
|
132
132
|
});
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
test_utils_1.assert.isLength(messages, 1);
|
|
134
|
+
test_utils_1.assert.isEqual(messages[0].body, 'What is up?');
|
|
135
135
|
//@ts-ignore
|
|
136
|
-
|
|
136
|
+
test_utils_1.assert.isFalsy(messages[0].target.isCore);
|
|
137
137
|
}
|
|
138
138
|
static async scriptCanAskToConfirm(confirmBody, expectedConfirmResults) {
|
|
139
139
|
let confirmStarted = false;
|
|
@@ -159,17 +159,17 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
159
159
|
body: 'tell me a story!',
|
|
160
160
|
});
|
|
161
161
|
await this.wait(100);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
test_utils_1.assert.isTrue(confirmStarted);
|
|
163
|
+
test_utils_1.assert.isUndefined(confirmResponse);
|
|
164
|
+
test_utils_1.assert.isFalse(confirmFinished);
|
|
165
165
|
await this.sendMessage(player, {
|
|
166
166
|
body: confirmBody,
|
|
167
167
|
});
|
|
168
168
|
await this.wait(100);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
test_utils_1.assert.isTrue(confirmStarted);
|
|
170
|
+
test_utils_1.assert.isEqual(confirmResponse, expectedConfirmResults);
|
|
171
|
+
test_utils_1.assert.isTrue(confirmFinished);
|
|
172
|
+
test_utils_1.assert.doesInclude(messages, { body: 'Are you sure?' });
|
|
173
173
|
}
|
|
174
174
|
static async scriptCanRespondWithTransition() {
|
|
175
175
|
const player = this.Player({
|
|
@@ -182,9 +182,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
182
182
|
const results = await this.sendMessage(player, {
|
|
183
183
|
body: 'tell me a story!',
|
|
184
184
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
test_utils_1.assert.isTruthy(results);
|
|
186
|
+
test_utils_1.assert.isTruthy(results.transitionConversationTo);
|
|
187
|
+
test_utils_1.assert.isEqual(results.transitionConversationTo, 'greeting');
|
|
188
188
|
}
|
|
189
189
|
static async scriptCanRespondWithTransitionAInLaterLines() {
|
|
190
190
|
const player = this.Player({
|
|
@@ -199,9 +199,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
199
199
|
const results = await this.sendMessage(player, {
|
|
200
200
|
body: 'tell me a story!',
|
|
201
201
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
test_utils_1.assert.isTruthy(results);
|
|
203
|
+
test_utils_1.assert.isTruthy(results.transitionConversationTo);
|
|
204
|
+
test_utils_1.assert.isEqual(results.transitionConversationTo, 'greeting');
|
|
205
205
|
}
|
|
206
206
|
static async scriptCanRespondWithTransitionAInLaterLinesAfterAskingForInput() {
|
|
207
207
|
const player = this.Player({
|
|
@@ -221,9 +221,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
221
221
|
const results = await this.sendMessage(player, {
|
|
222
222
|
body: 'Yes!',
|
|
223
223
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
test_utils_1.assert.isTruthy(results);
|
|
225
|
+
test_utils_1.assert.isTruthy(results.transitionConversationTo);
|
|
226
|
+
test_utils_1.assert.isEqual(results.transitionConversationTo, 'greeting');
|
|
227
227
|
}
|
|
228
228
|
static async randomOnOptions() {
|
|
229
229
|
const messages = [];
|
|
@@ -235,7 +235,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
235
235
|
},
|
|
236
236
|
script: [
|
|
237
237
|
async (options) => {
|
|
238
|
-
|
|
238
|
+
test_utils_1.assert.isFunction(options.rand);
|
|
239
239
|
const answer = options.rand(possibilities);
|
|
240
240
|
//@ts-ignore
|
|
241
241
|
delete remaining[answer];
|
|
@@ -254,7 +254,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
254
254
|
const player = this.Player({
|
|
255
255
|
script: [
|
|
256
256
|
async (options) => {
|
|
257
|
-
|
|
257
|
+
test_utils_1.assert.isFunction(options.rand);
|
|
258
258
|
answer = options.rand(possibilities);
|
|
259
259
|
},
|
|
260
260
|
],
|
|
@@ -262,7 +262,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
262
262
|
await this.sendMessage(player, {
|
|
263
263
|
body: 'go',
|
|
264
264
|
});
|
|
265
|
-
|
|
265
|
+
test_utils_1.assert.isTrue(possibilities.includes(answer));
|
|
266
266
|
}
|
|
267
267
|
static async retainsStateBetweenScriptLines() {
|
|
268
268
|
const player = this.Player({
|
|
@@ -271,7 +271,7 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
271
271
|
options.state.goTeam = true;
|
|
272
272
|
},
|
|
273
273
|
async (options) => {
|
|
274
|
-
|
|
274
|
+
test_utils_1.assert.isTrue(options.state.goTeam);
|
|
275
275
|
},
|
|
276
276
|
],
|
|
277
277
|
});
|
|
@@ -300,9 +300,9 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
300
300
|
await this.sendMessage(player, {
|
|
301
301
|
body: 'tell me a story!',
|
|
302
302
|
});
|
|
303
|
-
|
|
303
|
+
test_utils_1.assert.isEqual(stateCount, 2);
|
|
304
304
|
await this.sendMessage(player, { body: 'again, again!' });
|
|
305
|
-
|
|
305
|
+
test_utils_1.assert.isEqual(stateCount, 4);
|
|
306
306
|
}
|
|
307
307
|
static async alwaysEndsWithRedirectToDiscovery() {
|
|
308
308
|
let stateCount = 0;
|
|
@@ -325,11 +325,11 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
325
325
|
let results = await this.sendMessage(player, {
|
|
326
326
|
body: 'tell me a story!',
|
|
327
327
|
});
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
test_utils_1.assert.isEqual(results === null || results === void 0 ? void 0 : results.transitionConversationTo, 'discovery');
|
|
329
|
+
test_utils_1.assert.isEqual(stateCount, 2);
|
|
330
330
|
results = await this.sendMessage(player, { body: 'again, again!' });
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
test_utils_1.assert.isEqual(results === null || results === void 0 ? void 0 : results.transitionConversationTo, 'discovery');
|
|
332
|
+
test_utils_1.assert.isEqual(stateCount, 4);
|
|
333
333
|
}
|
|
334
334
|
static Player(options) {
|
|
335
335
|
var _a, _b;
|
|
@@ -345,69 +345,69 @@ class TopicScriptPlayerTest extends AbstractConversationTest_1.default {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
__decorate([
|
|
348
|
-
(0,
|
|
348
|
+
(0, test_utils_1.test)()
|
|
349
349
|
], TopicScriptPlayerTest, "throwsWhenRequiredOptionsNotSent", null);
|
|
350
350
|
__decorate([
|
|
351
|
-
(0,
|
|
351
|
+
(0, test_utils_1.test)()
|
|
352
352
|
], TopicScriptPlayerTest, "respondsToMessageWithOnlyLineInScript", null);
|
|
353
353
|
__decorate([
|
|
354
|
-
(0,
|
|
354
|
+
(0, test_utils_1.test)()
|
|
355
355
|
], TopicScriptPlayerTest, "respondsToMessagesWithAllLinesInScript", null);
|
|
356
356
|
__decorate([
|
|
357
|
-
(0,
|
|
357
|
+
(0, test_utils_1.test)()
|
|
358
358
|
], TopicScriptPlayerTest, "multipleTextLinesWaitsForDelay", null);
|
|
359
359
|
__decorate([
|
|
360
|
-
(0,
|
|
360
|
+
(0, test_utils_1.test)()
|
|
361
361
|
], TopicScriptPlayerTest, "restartsScriptNextMessage", null);
|
|
362
362
|
__decorate([
|
|
363
|
-
(0,
|
|
363
|
+
(0, test_utils_1.test)()
|
|
364
364
|
], TopicScriptPlayerTest, "respondsWithRandomLine", null);
|
|
365
365
|
__decorate([
|
|
366
|
-
(0,
|
|
366
|
+
(0, test_utils_1.test)()
|
|
367
367
|
], TopicScriptPlayerTest, "renderLineSendsMessage", null);
|
|
368
368
|
__decorate([
|
|
369
|
-
(0,
|
|
370
|
-
(0,
|
|
371
|
-
(0,
|
|
372
|
-
(0,
|
|
373
|
-
(0,
|
|
374
|
-
(0,
|
|
375
|
-
(0,
|
|
376
|
-
(0,
|
|
377
|
-
(0,
|
|
378
|
-
(0,
|
|
379
|
-
(0,
|
|
380
|
-
(0,
|
|
381
|
-
(0,
|
|
382
|
-
(0,
|
|
383
|
-
(0,
|
|
384
|
-
(0,
|
|
385
|
-
(0,
|
|
386
|
-
(0,
|
|
387
|
-
(0,
|
|
369
|
+
(0, test_utils_1.test)('Passes confirm when sent "Y"', 'Y', true),
|
|
370
|
+
(0, test_utils_1.test)('Passes confirm when sent "y"', 'y', true),
|
|
371
|
+
(0, test_utils_1.test)('Passes confirm when sent "yes"', 'yes', true),
|
|
372
|
+
(0, test_utils_1.test)('Passes confirm when sent "yup"', 'yup', true),
|
|
373
|
+
(0, test_utils_1.test)('Passes confirm when sent "yes please"', 'yes please', true),
|
|
374
|
+
(0, test_utils_1.test)('Passes confirm when sent "yeah"', 'yeah', true),
|
|
375
|
+
(0, test_utils_1.test)('Passes confirm when sent "yeah!!!"', 'yeah!!!', true),
|
|
376
|
+
(0, test_utils_1.test)('Passes confirm when sent "oh heck ya"', 'oh heck ya', true),
|
|
377
|
+
(0, test_utils_1.test)('Passes confirm when sent "oh heck yeah"', 'oh heck yeah', true),
|
|
378
|
+
(0, test_utils_1.test)('Passes confirm when sent "👍"', '👍', true),
|
|
379
|
+
(0, test_utils_1.test)('Fails confirm when sent "negative"', 'negative', false),
|
|
380
|
+
(0, test_utils_1.test)('Fails confirm when sent "nope"', 'nope', false),
|
|
381
|
+
(0, test_utils_1.test)('Fails confirm when sent "nope!!"', 'nope!!', false),
|
|
382
|
+
(0, test_utils_1.test)('Fails confirm when sent "no"', 'no', false),
|
|
383
|
+
(0, test_utils_1.test)('Fails confirm when sent "no thanks"', 'no thanks', false),
|
|
384
|
+
(0, test_utils_1.test)('Fails confirm when sent "no thank you"', 'no thank you', false),
|
|
385
|
+
(0, test_utils_1.test)('Fails confirm when sent "nah"', 'nah', false),
|
|
386
|
+
(0, test_utils_1.test)('Fails confirm when sent "No thanks!!!"', 'No thanks!!!', false),
|
|
387
|
+
(0, test_utils_1.test)('Fails confirm when sent "👎"', '👎', true)
|
|
388
388
|
], TopicScriptPlayerTest, "scriptCanAskToConfirm", null);
|
|
389
389
|
__decorate([
|
|
390
|
-
(0,
|
|
390
|
+
(0, test_utils_1.test)()
|
|
391
391
|
], TopicScriptPlayerTest, "scriptCanRespondWithTransition", null);
|
|
392
392
|
__decorate([
|
|
393
|
-
(0,
|
|
393
|
+
(0, test_utils_1.test)()
|
|
394
394
|
], TopicScriptPlayerTest, "scriptCanRespondWithTransitionAInLaterLines", null);
|
|
395
395
|
__decorate([
|
|
396
|
-
(0,
|
|
396
|
+
(0, test_utils_1.test)()
|
|
397
397
|
], TopicScriptPlayerTest, "scriptCanRespondWithTransitionAInLaterLinesAfterAskingForInput", null);
|
|
398
398
|
__decorate([
|
|
399
|
-
(0,
|
|
399
|
+
(0, test_utils_1.test)()
|
|
400
400
|
], TopicScriptPlayerTest, "randomOnOptions", null);
|
|
401
401
|
__decorate([
|
|
402
|
-
(0,
|
|
402
|
+
(0, test_utils_1.test)()
|
|
403
403
|
], TopicScriptPlayerTest, "randomOptionsRandomOnNotString", null);
|
|
404
404
|
__decorate([
|
|
405
|
-
(0,
|
|
405
|
+
(0, test_utils_1.test)()
|
|
406
406
|
], TopicScriptPlayerTest, "retainsStateBetweenScriptLines", null);
|
|
407
407
|
__decorate([
|
|
408
|
-
(0,
|
|
408
|
+
(0, test_utils_1.test)()
|
|
409
409
|
], TopicScriptPlayerTest, "retainsStateBetweenMessages", null);
|
|
410
410
|
__decorate([
|
|
411
|
-
(0,
|
|
411
|
+
(0, test_utils_1.test)()
|
|
412
412
|
], TopicScriptPlayerTest, "alwaysEndsWithRedirectToDiscovery", null);
|
|
413
413
|
exports.default = TopicScriptPlayerTest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AbstractSpruceTest from '@sprucelabs/test';
|
|
1
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
2
2
|
export default class TopicSuggesterTest extends AbstractSpruceTest {
|
|
3
3
|
protected static canCreateTopicSuggester(): Promise<void>;
|
|
4
4
|
protected static canReturnOnlyTopic(): Promise<void>;
|
|
@@ -29,12 +29,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
const
|
|
32
|
+
const test_utils_1 = __importStar(require("@sprucelabs/test-utils"));
|
|
33
33
|
const TopicSuggester_1 = require("../../topics/TopicSuggester");
|
|
34
|
-
class TopicSuggesterTest extends
|
|
34
|
+
class TopicSuggesterTest extends test_utils_1.default {
|
|
35
35
|
static async canCreateTopicSuggester() {
|
|
36
36
|
const topicSuggester = await TopicSuggester_1.TopicSuggester.Suggester({ topics: [] });
|
|
37
|
-
|
|
37
|
+
test_utils_1.assert.isTruthy(topicSuggester);
|
|
38
38
|
}
|
|
39
39
|
static async canReturnOnlyTopic() {
|
|
40
40
|
const topics = [
|
|
@@ -46,11 +46,11 @@ class TopicSuggesterTest extends test_1.default {
|
|
|
46
46
|
];
|
|
47
47
|
const messageBody = 'book';
|
|
48
48
|
const suggestions = await this.Suggester(topics, messageBody);
|
|
49
|
-
|
|
49
|
+
test_utils_1.assert.doesInclude(suggestions[0], {
|
|
50
50
|
key: 'bookAppointment',
|
|
51
51
|
label: 'Book an appointment',
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
test_utils_1.assert.isAbove(suggestions[0].confidence, 0);
|
|
54
54
|
}
|
|
55
55
|
static async makeSureTopicsAreReturnedInOrderOfConfidence() {
|
|
56
56
|
const suggestions = await this.Suggester([
|
|
@@ -70,8 +70,8 @@ class TopicSuggesterTest extends test_1.default {
|
|
|
70
70
|
],
|
|
71
71
|
},
|
|
72
72
|
], "I'd like to schedule a haircut");
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
test_utils_1.assert.isLength(suggestions, 2);
|
|
74
|
+
test_utils_1.assert.isEqualDeep(suggestions[0].key, 'bookAppointment');
|
|
75
75
|
}
|
|
76
76
|
static async matchTests(phrase, expectedSuggestionKey) {
|
|
77
77
|
const suggestions = await this.Suggester([
|
|
@@ -100,9 +100,9 @@ class TopicSuggesterTest extends test_1.default {
|
|
|
100
100
|
],
|
|
101
101
|
},
|
|
102
102
|
], phrase);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
test_utils_1.assert.isLength(suggestions, 2);
|
|
104
|
+
test_utils_1.assert.isEqualDeep(suggestions[0].key, expectedSuggestionKey);
|
|
105
|
+
test_utils_1.assert.isAbove(suggestions[0].confidence, 0.8);
|
|
106
106
|
}
|
|
107
107
|
static async Suggester(topics, messageBody) {
|
|
108
108
|
const topicSuggester = await TopicSuggester_1.TopicSuggester.Suggester({
|
|
@@ -113,19 +113,19 @@ class TopicSuggesterTest extends test_1.default {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
__decorate([
|
|
116
|
-
(0,
|
|
116
|
+
(0, test_utils_1.test)()
|
|
117
117
|
], TopicSuggesterTest, "canCreateTopicSuggester", null);
|
|
118
118
|
__decorate([
|
|
119
|
-
(0,
|
|
119
|
+
(0, test_utils_1.test)()
|
|
120
120
|
], TopicSuggesterTest, "canReturnOnlyTopic", null);
|
|
121
121
|
__decorate([
|
|
122
|
-
(0,
|
|
122
|
+
(0, test_utils_1.test)()
|
|
123
123
|
], TopicSuggesterTest, "makeSureTopicsAreReturnedInOrderOfConfidence", null);
|
|
124
124
|
__decorate([
|
|
125
|
-
(0,
|
|
126
|
-
(0,
|
|
127
|
-
(0,
|
|
128
|
-
(0,
|
|
129
|
-
(0,
|
|
125
|
+
(0, test_utils_1.test)('matches regardless "Experience "', 'Experience ', 'contactUs'),
|
|
126
|
+
(0, test_utils_1.test)('matches regardless "Tell me about experience"', 'Tell me about experience ', 'contactUs'),
|
|
127
|
+
(0, test_utils_1.test)('matches "Tell me something funny"', 'Tell me something funny', 'jokes'),
|
|
128
|
+
(0, test_utils_1.test)('matches "Joke me"', 'Joke me', 'jokes'),
|
|
129
|
+
(0, test_utils_1.test)('matches "Joke me"', 'Joke me', 'jokes')
|
|
130
130
|
], TopicSuggesterTest, "matchTests", null);
|
|
131
131
|
exports.default = TopicSuggesterTest;
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import plugin from '../../plugins/conversation.plugin.js';
|
|
19
19
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
18
18
|
export default class KillingASkillTest extends AbstractConversationTest {
|
|
19
19
|
static killingASkillKillsConversation() {
|
|
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
|
|
17
|
-
import { test, assert } from '@sprucelabs/test';
|
|
17
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
18
18
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
19
19
|
import plugin from '../../plugins/conversation.plugin.js';
|
|
20
20
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
|
|
17
|
-
import { test, assert } from '@sprucelabs/test';
|
|
17
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
19
|
export default class RespondingToMessagesTest extends AbstractConversationTest {
|
|
20
20
|
static beforeEach() {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
19
|
export default class TestingAConversationTest extends AbstractConversationTest {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import { ConversationCoordinator } from '../../conversations/ConversationCoordinator.js';
|
|
19
19
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import EmailFieldHandler from '../../../interfaces/fieldHandlers/EmailFieldHandler.js';
|
|
18
18
|
import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
|
|
19
19
|
export default class TextFieldTest extends AbstractGraphicsInterfaceTest {
|
package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js
CHANGED
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
|
|
19
19
|
export default class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
|
|
18
18
|
export default class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest {
|
|
19
19
|
static respondingWithNumberSelectsOptions() {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
|
|
18
18
|
export default class TextFieldTest extends AbstractGraphicsInterfaceTest {
|
|
19
19
|
static promptSendsLabel() {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
19
|
import ScriptTester, { END_OF_LINE, generateTransitionMessage, } from '../../tests/ScriptTester.js';
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
18
18
|
import suggesterUtil from '../../utilities/suggester.utility.js';
|
|
19
19
|
export default class SuggesterUtilTest extends AbstractConversationTest {
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
19
|
import TopicLoader from '../../topics/TopicLoader.js';
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
18
|
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
19
|
import { TopicScriptPlayer } from '../../topics/TopicScriptPlayer.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AbstractSpruceTest from '@sprucelabs/test';
|
|
1
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
2
2
|
export default class TopicSuggesterTest extends AbstractSpruceTest {
|
|
3
3
|
protected static canCreateTopicSuggester(): Promise<void>;
|
|
4
4
|
protected static canReturnOnlyTopic(): Promise<void>;
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import AbstractSpruceTest, { test, assert } from '@sprucelabs/test';
|
|
16
|
+
import AbstractSpruceTest, { test, assert } from '@sprucelabs/test-utils';
|
|
17
17
|
import { TopicSuggester } from '../../topics/TopicSuggester.js';
|
|
18
18
|
export default class TopicSuggesterTest extends AbstractSpruceTest {
|
|
19
19
|
static canCreateTopicSuggester() {
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@types/inquirer"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "49.0.
|
|
16
|
+
"version": "49.0.42",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"@sprucelabs/mercury-core-events": "^12.2.15",
|
|
69
69
|
"@sprucelabs/schema": "^28.5.12",
|
|
70
70
|
"@sprucelabs/spruce-core-schemas": "^34.2.102",
|
|
71
|
-
"@sprucelabs/spruce-event-plugin": "^49.0.
|
|
71
|
+
"@sprucelabs/spruce-event-plugin": "^49.0.42",
|
|
72
72
|
"@sprucelabs/spruce-event-utils": "^27.0.175",
|
|
73
|
-
"@sprucelabs/spruce-skill-booter": "^49.0.
|
|
73
|
+
"@sprucelabs/spruce-skill-booter": "^49.0.42",
|
|
74
74
|
"@sprucelabs/spruce-skill-utils": "^26.4.79",
|
|
75
|
-
"@sprucelabs/spruce-test-fixtures": "^49.0.
|
|
75
|
+
"@sprucelabs/spruce-test-fixtures": "^49.0.42",
|
|
76
76
|
"fuzzyset": "^1.0.7",
|
|
77
77
|
"globby": "^11.0.4",
|
|
78
78
|
"inquirer": "^8.2.4",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "5b528e70f1ced8136792eb731fef7e4e42368f22"
|
|
123
123
|
}
|