@sprucelabs/spruce-conversation-plugin 62.2.24 → 62.2.26
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 +17 -17
- package/build/__tests__/behavioral/CheckingHealth.test.d.ts +0 -10
- package/build/__tests__/behavioral/CheckingHealth.test.js +0 -87
- package/build/__tests__/behavioral/KillingASkill.test.d.ts +0 -4
- package/build/__tests__/behavioral/KillingASkill.test.js +0 -29
- package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +0 -13
- package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +0 -147
- package/build/__tests__/behavioral/RespondingToMessages.test.d.ts +0 -13
- package/build/__tests__/behavioral/RespondingToMessages.test.js +0 -134
- package/build/__tests__/behavioral/TestingAConversation.test.d.ts +0 -14
- package/build/__tests__/behavioral/TestingAConversation.test.js +0 -110
- package/build/__tests__/implementation/ConversationCoordinator.test.d.ts +0 -18
- package/build/__tests__/implementation/ConversationCoordinator.test.js +0 -185
- package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +0 -7
- package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +0 -73
- package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +0 -4
- package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +0 -42
- package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.d.ts +0 -5
- package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.js +0 -62
- package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.d.ts +0 -18
- package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.js +0 -168
- package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +0 -7
- package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +0 -71
- package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +0 -6
- package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +0 -48
- package/build/__tests__/implementation/ScriptTester.test.d.ts +0 -19
- package/build/__tests__/implementation/ScriptTester.test.js +0 -461
- package/build/__tests__/implementation/SuggesterUtil.test.d.ts +0 -7
- package/build/__tests__/implementation/SuggesterUtil.test.js +0 -63
- package/build/__tests__/implementation/TopicLoader.test.d.ts +0 -8
- package/build/__tests__/implementation/TopicLoader.test.js +0 -66
- package/build/__tests__/implementation/TopicScriptPlayer.test.d.ts +0 -23
- package/build/__tests__/implementation/TopicScriptPlayer.test.js +0 -436
- package/build/__tests__/implementation/TopicSuggester.test.d.ts +0 -8
- package/build/__tests__/implementation/TopicSuggester.test.js +0 -137
- package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
- package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +0 -1
- package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +0 -4
- package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +0 -4
- package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +0 -8
- package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +0 -12
- package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +0 -8
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +0 -12
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +0 -21
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +0 -21
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +0 -29
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +0 -22
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +0 -14
- package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.js +0 -8
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.d.ts +0 -2
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.js +0 -3
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +0 -16
- package/build/esm/__tests__/behavioral/CheckingHealth.test.d.ts +0 -10
- package/build/esm/__tests__/behavioral/CheckingHealth.test.js +0 -104
- package/build/esm/__tests__/behavioral/KillingASkill.test.d.ts +0 -4
- package/build/esm/__tests__/behavioral/KillingASkill.test.js +0 -34
- package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +0 -13
- package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +0 -171
- package/build/esm/__tests__/behavioral/RespondingToMessages.test.d.ts +0 -13
- package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +0 -158
- package/build/esm/__tests__/behavioral/TestingAConversation.test.d.ts +0 -14
- package/build/esm/__tests__/behavioral/TestingAConversation.test.js +0 -137
- package/build/esm/__tests__/implementation/ConversationCoordinator.test.d.ts +0 -18
- package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +0 -214
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +0 -7
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +0 -84
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +0 -4
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +0 -47
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.d.ts +0 -5
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.js +0 -47
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.d.ts +0 -18
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.js +0 -172
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +0 -7
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +0 -80
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +0 -6
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +0 -57
- package/build/esm/__tests__/implementation/ScriptTester.test.d.ts +0 -19
- package/build/esm/__tests__/implementation/ScriptTester.test.js +0 -470
- package/build/esm/__tests__/implementation/SuggesterUtil.test.d.ts +0 -7
- package/build/esm/__tests__/implementation/SuggesterUtil.test.js +0 -74
- package/build/esm/__tests__/implementation/TopicLoader.test.d.ts +0 -8
- package/build/esm/__tests__/implementation/TopicLoader.test.js +0 -79
- package/build/esm/__tests__/implementation/TopicScriptPlayer.test.d.ts +0 -23
- package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +0 -477
- package/build/esm/__tests__/implementation/TopicSuggester.test.d.ts +0 -8
- package/build/esm/__tests__/implementation/TopicSuggester.test.js +0 -130
- package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
- package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +0 -1
- package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +0 -2
- package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +0 -2
- package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +0 -2
- package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +0 -2
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +0 -6
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +0 -10
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +0 -6
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +0 -10
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +0 -28
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +0 -28
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +0 -36
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +0 -29
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +0 -21
- package/build/esm/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.js +0 -6
- package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +0 -3
- package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +0 -14
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'Cancel appointment',
|
|
5
|
-
utterances: [
|
|
6
|
-
'Cancel appointment',
|
|
7
|
-
'Can i cancel my appointment?',
|
|
8
|
-
'cancel',
|
|
9
|
-
],
|
|
10
|
-
script: ['how are you?', 'Lemme find your appointment!'],
|
|
11
|
-
};
|
|
12
|
-
exports.default = topicDefinition;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'book appointment',
|
|
5
|
-
utterances: ['book appointment', 'Can i book my appointment?', 'book'],
|
|
6
|
-
script: ['Sweet, lets book!', 'Lemme find your appointment!'],
|
|
7
|
-
};
|
|
8
|
-
exports.default = topicDefinition;
|
package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'Cancel appointment',
|
|
5
|
-
utterances: [
|
|
6
|
-
'Cancel appointment',
|
|
7
|
-
'Can i cancel my appointment?',
|
|
8
|
-
'cancel',
|
|
9
|
-
],
|
|
10
|
-
script: ['how are you?', 'Lemme find your appointment!'],
|
|
11
|
-
};
|
|
12
|
-
exports.default = topicDefinition;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'favorite color',
|
|
5
|
-
utterances: ['favorite color'],
|
|
6
|
-
script: [
|
|
7
|
-
'what is your favorite color?',
|
|
8
|
-
async (options) => {
|
|
9
|
-
const answer = await options.ui.prompt({
|
|
10
|
-
type: 'text',
|
|
11
|
-
isRequired: true,
|
|
12
|
-
});
|
|
13
|
-
options.ui.renderLine(answer);
|
|
14
|
-
return {
|
|
15
|
-
transitionConversationTo: 'discovery',
|
|
16
|
-
repairs: ['go', 'team'],
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
21
|
-
exports.default = topicDefinition;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'favorite color',
|
|
5
|
-
utterances: ['favorite color'],
|
|
6
|
-
script: [
|
|
7
|
-
'what is your favorite color?',
|
|
8
|
-
async (options) => {
|
|
9
|
-
const answer = await options.ui.prompt({
|
|
10
|
-
type: 'text',
|
|
11
|
-
isRequired: true,
|
|
12
|
-
});
|
|
13
|
-
options.ui.renderLine(answer);
|
|
14
|
-
return {
|
|
15
|
-
transitionConversationTo: 'discovery',
|
|
16
|
-
topicChangers: ['now', 'this'],
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
21
|
-
exports.default = topicDefinition;
|
package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'mixed strings and callback',
|
|
5
|
-
utterances: ['mixed'],
|
|
6
|
-
script: [
|
|
7
|
-
'string 1',
|
|
8
|
-
async (options) => {
|
|
9
|
-
const answer = await options.ui.prompt({
|
|
10
|
-
type: 'text',
|
|
11
|
-
isRequired: true,
|
|
12
|
-
label: 'prompt 1',
|
|
13
|
-
});
|
|
14
|
-
options.ui.renderLine(answer);
|
|
15
|
-
},
|
|
16
|
-
'string 2',
|
|
17
|
-
async (options) => {
|
|
18
|
-
const answer = await options.ui.prompt({
|
|
19
|
-
type: 'text',
|
|
20
|
-
isRequired: true,
|
|
21
|
-
label: 'prompt 2',
|
|
22
|
-
});
|
|
23
|
-
options.ui.renderLine(answer);
|
|
24
|
-
return {};
|
|
25
|
-
},
|
|
26
|
-
['and done', 'and done', 'and done'],
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
exports.default = topicDefinition;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_1 = require("@sprucelabs/test");
|
|
4
|
-
const topicDefinition = {
|
|
5
|
-
label: 'asserts good callback options',
|
|
6
|
-
utterances: ['good options'],
|
|
7
|
-
script: [
|
|
8
|
-
async (options) => {
|
|
9
|
-
test_1.assert.isTruthy(options);
|
|
10
|
-
test_1.assert.isFunction(options.rand);
|
|
11
|
-
test_1.assert.isTruthy(options.message);
|
|
12
|
-
test_1.assert.isEqual(options.message.body, 'hello');
|
|
13
|
-
},
|
|
14
|
-
async (options) => {
|
|
15
|
-
test_1.assert.isTruthy(options);
|
|
16
|
-
test_1.assert.isFunction(options.rand);
|
|
17
|
-
test_1.assert.isTruthy(options.message);
|
|
18
|
-
test_1.assert.isEqual(options.message.body, 'hello');
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
};
|
|
22
|
-
exports.default = topicDefinition;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const test_1 = require("@sprucelabs/test");
|
|
4
|
-
const topicDefinition = {
|
|
5
|
-
label: 'asserts only called once',
|
|
6
|
-
utterances: ['only called once'],
|
|
7
|
-
script: [
|
|
8
|
-
async (options) => {
|
|
9
|
-
test_1.assert.isFalsy(options.state.hasBeenRun);
|
|
10
|
-
options.state.hasBeenRun = true;
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
exports.default = topicDefinition;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'book appointment',
|
|
5
|
-
utterances: ['book appointment', 'Can i book my appointment?', 'book'],
|
|
6
|
-
script: ['Sweet, lets book!', 'Lemme find your appointment!'],
|
|
7
|
-
};
|
|
8
|
-
exports.default = topicDefinition;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const topicDefinition = {
|
|
4
|
-
label: 'Cancel appointment',
|
|
5
|
-
utterances: [
|
|
6
|
-
'Cancel appointment',
|
|
7
|
-
'Can i cancel my appointment?',
|
|
8
|
-
'cancel',
|
|
9
|
-
],
|
|
10
|
-
script: [
|
|
11
|
-
() => {
|
|
12
|
-
throw new Error('In Script');
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
};
|
|
16
|
-
exports.default = topicDefinition;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest';
|
|
2
|
-
export default class CheckingHealthTest extends AbstractConversationTest {
|
|
3
|
-
protected static pluginReturnsInstance(): Promise<void>;
|
|
4
|
-
protected static registersWithSkill(): Promise<void>;
|
|
5
|
-
protected static throwsWhenExecutingIfEventPluginMissing(): Promise<void>;
|
|
6
|
-
protected static returnsZeroStateResponseFromHealthCheckWhenNoConversations(): Promise<void>;
|
|
7
|
-
private static checkHealth;
|
|
8
|
-
protected static returnsHelpfulErrorWHenPassedBadConvos(): Promise<void>;
|
|
9
|
-
protected static getsTopicsFromHealthCheck(): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
|
-
import { errorAssert } from '@sprucelabs/test-utils';
|
|
18
|
-
import plugin from '../../plugins/conversation.plugin.js';
|
|
19
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
20
|
-
export default class CheckingHealthTest extends AbstractConversationTest {
|
|
21
|
-
static pluginReturnsInstance() {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
assert.isTrue(plugin instanceof Function);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static registersWithSkill() {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const skill = yield this.Skill();
|
|
29
|
-
const features = skill.getFeatures();
|
|
30
|
-
assert.isLength(features, 2);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
static throwsWhenExecutingIfEventPluginMissing() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
var _a;
|
|
36
|
-
const health = yield this.checkHealth({ plugins: [plugin] });
|
|
37
|
-
assert.isTruthy(health.conversation);
|
|
38
|
-
assert.isEqual(health.conversation.status, 'failed');
|
|
39
|
-
const err = (_a = health.conversation.errors) === null || _a === void 0 ? void 0 : _a[0];
|
|
40
|
-
assert.isTruthy(err);
|
|
41
|
-
errorAssert.assertError(err, 'MISSING_DEPENDENCIES', {
|
|
42
|
-
dependencies: ['event.plugin'],
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
static returnsZeroStateResponseFromHealthCheckWhenNoConversations() {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const healthCheck = yield this.checkHealth();
|
|
49
|
-
assert.isTruthy(healthCheck.conversation);
|
|
50
|
-
assert.isEqual(healthCheck.conversation.status, 'passed');
|
|
51
|
-
assert.isEqualDeep(healthCheck.conversation.topics, []);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
static checkHealth(options) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const skill = yield this.Skill(options);
|
|
57
|
-
const healthCheck = yield skill.checkHealth();
|
|
58
|
-
return healthCheck;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
static returnsHelpfulErrorWHenPassedBadConvos() {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const healthCheck = yield this.checkHealth({
|
|
65
|
-
activeDir: this.resolvePath(__dirname, '..', 'testDirsAndFiles', 'bad-missing-params'),
|
|
66
|
-
});
|
|
67
|
-
assert.isTruthy(healthCheck.conversation);
|
|
68
|
-
assert.isEqual(healthCheck.conversation.status, 'failed');
|
|
69
|
-
errorAssert.assertError((_a = healthCheck.conversation.errors) === null || _a === void 0 ? void 0 : _a[0], 'CONVERSATION_PLUGIN_ERROR');
|
|
70
|
-
errorAssert.assertError((_b = healthCheck.conversation.errors) === null || _b === void 0 ? void 0 : _b[0].originalError, 'INVALID_TOPIC');
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
static getsTopicsFromHealthCheck() {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const healthCheck = yield this.checkHealth({
|
|
76
|
-
activeDir: this.resolvePath(__dirname, '..', 'testDirsAndFiles', 'good'),
|
|
77
|
-
});
|
|
78
|
-
assert.isTruthy(healthCheck.conversation);
|
|
79
|
-
assert.isLength(healthCheck.conversation.topics, 2);
|
|
80
|
-
assert.isEqualDeep(healthCheck.conversation.topics, [
|
|
81
|
-
'bookAppointment',
|
|
82
|
-
'cancelAppointment',
|
|
83
|
-
]);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
__decorate([
|
|
88
|
-
test()
|
|
89
|
-
], CheckingHealthTest, "pluginReturnsInstance", null);
|
|
90
|
-
__decorate([
|
|
91
|
-
test()
|
|
92
|
-
], CheckingHealthTest, "registersWithSkill", null);
|
|
93
|
-
__decorate([
|
|
94
|
-
test()
|
|
95
|
-
], CheckingHealthTest, "throwsWhenExecutingIfEventPluginMissing", null);
|
|
96
|
-
__decorate([
|
|
97
|
-
test()
|
|
98
|
-
], CheckingHealthTest, "returnsZeroStateResponseFromHealthCheckWhenNoConversations", null);
|
|
99
|
-
__decorate([
|
|
100
|
-
test()
|
|
101
|
-
], CheckingHealthTest, "returnsHelpfulErrorWHenPassedBadConvos", null);
|
|
102
|
-
__decorate([
|
|
103
|
-
test()
|
|
104
|
-
], CheckingHealthTest, "getsTopicsFromHealthCheck", null);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { MercuryFixture } from '@sprucelabs/spruce-test-fixtures';
|
|
17
|
-
import { test, assert } from '@sprucelabs/test-utils';
|
|
18
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
|
-
MercuryFixture.setShouldRequireLocalListeners(false);
|
|
20
|
-
export default class KillingASkillTest extends AbstractConversationTest {
|
|
21
|
-
static killingASkillKillsConversation() {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
this.cwd = this.resolveTestPath('empty-skill');
|
|
24
|
-
const { skill } = yield this.bootAndRegisterNewSkill({
|
|
25
|
-
name: 'great skill dude!',
|
|
26
|
-
});
|
|
27
|
-
yield skill.kill();
|
|
28
|
-
assert.isFalse(skill.isRunning());
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
__decorate([
|
|
33
|
-
test()
|
|
34
|
-
], KillingASkillTest, "killingASkillKillsConversation", null);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest';
|
|
2
|
-
export default class RegisteringConversationsOnBootTest extends AbstractConversationTest {
|
|
3
|
-
protected static throwsWhenExecutingIfEventPluginMissing(): Promise<void>;
|
|
4
|
-
protected static noConvosToStart(): Promise<void>;
|
|
5
|
-
protected static registersConvosOnBoot(): Promise<void>;
|
|
6
|
-
protected static skillShutsDownWhenConvosFailToRegister(): Promise<void>;
|
|
7
|
-
protected static canBootASecondTime(): Promise<void>;
|
|
8
|
-
protected static skillCanBootASecondTime(): Promise<void>;
|
|
9
|
-
protected static coordinaterGetsSkillContext(): Promise<void>;
|
|
10
|
-
private static registerBootAndConnect;
|
|
11
|
-
private static assertExpectedTopics;
|
|
12
|
-
private static registerAndBoot;
|
|
13
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
|
|
17
|
-
import { MercuryFixture } from '@sprucelabs/spruce-test-fixtures';
|
|
18
|
-
import { test, assert, generateId } from '@sprucelabs/test-utils';
|
|
19
|
-
import { errorAssert } from '@sprucelabs/test-utils';
|
|
20
|
-
import plugin from '../../plugins/conversation.plugin.js';
|
|
21
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
22
|
-
MercuryFixture.setShouldRequireLocalListeners(false);
|
|
23
|
-
export default class RegisteringConversationsOnBootTest extends AbstractConversationTest {
|
|
24
|
-
static throwsWhenExecutingIfEventPluginMissing() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const skill = yield this.Skill({ plugins: [plugin] });
|
|
27
|
-
const err = yield assert.doesThrowAsync(() => skill.execute());
|
|
28
|
-
errorAssert.assertError(err, 'MISSING_DEPENDENCIES', {
|
|
29
|
-
dependencies: ['event.plugin'],
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
static noConvosToStart() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
this.cwd = this.resolveTestPath('empty-skill');
|
|
36
|
-
const { topics } = yield this.registerAndBoot();
|
|
37
|
-
assert.isLength(topics, 0);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
static registersConvosOnBoot() {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
this.cwd = this.resolveTestPath('skill');
|
|
43
|
-
const { topics } = yield this.registerAndBoot();
|
|
44
|
-
this.assertExpectedTopics(topics);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
static skillShutsDownWhenConvosFailToRegister() {
|
|
48
|
-
const _super = Object.create(null, {
|
|
49
|
-
bootSkill: { get: () => super.bootSkill }
|
|
50
|
-
});
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const { skill } = yield _super.bootSkill.call(this, {
|
|
53
|
-
shouldSuppressBootErrors: true,
|
|
54
|
-
});
|
|
55
|
-
assert.isFalse(skill.isRunning());
|
|
56
|
-
this.clearSkillBootErrors();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
static canBootASecondTime() {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
this.cwd = this.resolveTestPath('skill');
|
|
62
|
-
const { topics } = yield this.registerAndBoot();
|
|
63
|
-
this.assertExpectedTopics(topics);
|
|
64
|
-
const { topics: topics2 } = yield this.registerAndBoot({
|
|
65
|
-
skillId: process.env.SKILL_ID,
|
|
66
|
-
apiKey: process.env.SKILL_API_KEY,
|
|
67
|
-
});
|
|
68
|
-
this.assertExpectedTopics(topics2);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
static skillCanBootASecondTime() {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
this.cwd = this.resolveTestPath('skill');
|
|
74
|
-
yield this.registerAndBoot();
|
|
75
|
-
yield this.registerAndBoot({
|
|
76
|
-
skillId: process.env.SKILL_ID,
|
|
77
|
-
apiKey: process.env.SKILL_API_KEY,
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
static coordinaterGetsSkillContext() {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
this.cwd = this.resolveTestPath('skill');
|
|
84
|
-
const { skill, client } = yield this.registerBootAndConnect();
|
|
85
|
-
const id = generateId();
|
|
86
|
-
yield client.emitAndFlattenResponses('did-message::v2020_12_25', {
|
|
87
|
-
payload: {
|
|
88
|
-
message: this.buildMessage({
|
|
89
|
-
body: generateId(),
|
|
90
|
-
source: {
|
|
91
|
-
personId: id,
|
|
92
|
-
},
|
|
93
|
-
}),
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
const conversations = skill.getFeatureByCode('conversation');
|
|
97
|
-
//@ts-ignore
|
|
98
|
-
const coordinator = yield conversations.coordinatorsBySource[id];
|
|
99
|
-
assert.isTruthy(coordinator);
|
|
100
|
-
//@ts-ignore
|
|
101
|
-
skill.updateContext('hello', 'world');
|
|
102
|
-
assert.isEqualDeep(coordinator.getContext(), { hello: 'world' });
|
|
103
|
-
//@ts-ignore
|
|
104
|
-
skill.updateContext('hello2', 'world2');
|
|
105
|
-
assert.isEqualDeep(coordinator.getContext(), {
|
|
106
|
-
hello: 'world',
|
|
107
|
-
hello2: 'world2',
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
static registerBootAndConnect() {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
const { skill } = yield this.registerAndBoot();
|
|
114
|
-
const events = skill.getFeatureByCode('event');
|
|
115
|
-
const client = yield events.connectToApi();
|
|
116
|
-
return { skill, client };
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
static assertExpectedTopics(topics) {
|
|
120
|
-
assert.isLength(topics, 5);
|
|
121
|
-
assert.doesInclude(topics, { key: 'bookAppointment' });
|
|
122
|
-
assert.doesInclude(topics, { key: 'cancelAppointment' });
|
|
123
|
-
assert.doesInclude(topics, { key: 'favoriteColor' });
|
|
124
|
-
assert.doesInclude(topics, { key: 'favoriteColorTopicChanger' });
|
|
125
|
-
assert.doesInclude(topics, { key: 'mixedStringsAndCallbacks' });
|
|
126
|
-
}
|
|
127
|
-
static registerAndBoot(options) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
if (options === null || options === void 0 ? void 0 : options.skillId) {
|
|
130
|
-
process.env.SKILL_ID = options.skillId;
|
|
131
|
-
process.env.SKILL_API_KEY = options.apiKey;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
const registeredSkill = yield this.Fixture('skill').seedDemoSkill({
|
|
135
|
-
name: 'my great skill',
|
|
136
|
-
});
|
|
137
|
-
process.env.SKILL_ID = registeredSkill.id;
|
|
138
|
-
process.env.SKILL_API_KEY = registeredSkill.apiKey;
|
|
139
|
-
}
|
|
140
|
-
const { skill } = yield this.bootSkill();
|
|
141
|
-
const eventFeature = skill.getFeatureByCode('event');
|
|
142
|
-
const client = yield eventFeature.connectToApi();
|
|
143
|
-
let topics;
|
|
144
|
-
const results = yield client.emit('get-conversation-topics::v2020_12_25');
|
|
145
|
-
const payload = eventResponseUtil.getFirstResponseOrThrow(results);
|
|
146
|
-
topics = payload.topics;
|
|
147
|
-
return { topics, skill };
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
__decorate([
|
|
152
|
-
test()
|
|
153
|
-
], RegisteringConversationsOnBootTest, "throwsWhenExecutingIfEventPluginMissing", null);
|
|
154
|
-
__decorate([
|
|
155
|
-
test()
|
|
156
|
-
], RegisteringConversationsOnBootTest, "noConvosToStart", null);
|
|
157
|
-
__decorate([
|
|
158
|
-
test()
|
|
159
|
-
], RegisteringConversationsOnBootTest, "registersConvosOnBoot", null);
|
|
160
|
-
__decorate([
|
|
161
|
-
test()
|
|
162
|
-
], RegisteringConversationsOnBootTest, "skillShutsDownWhenConvosFailToRegister", null);
|
|
163
|
-
__decorate([
|
|
164
|
-
test()
|
|
165
|
-
], RegisteringConversationsOnBootTest, "canBootASecondTime", null);
|
|
166
|
-
__decorate([
|
|
167
|
-
test()
|
|
168
|
-
], RegisteringConversationsOnBootTest, "skillCanBootASecondTime", null);
|
|
169
|
-
__decorate([
|
|
170
|
-
test()
|
|
171
|
-
], RegisteringConversationsOnBootTest, "coordinaterGetsSkillContext", null);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import AbstractConversationTest from '../../tests/AbstractConversationTest';
|
|
2
|
-
export default class RespondingToMessagesTest extends AbstractConversationTest {
|
|
3
|
-
private static client;
|
|
4
|
-
protected static beforeEach(): Promise<void>;
|
|
5
|
-
protected static respondsToFirstMessageWithSuggestedTopics(): Promise<void>;
|
|
6
|
-
protected static scriptSendsMessages(): Promise<void>;
|
|
7
|
-
protected static scriptCallbacksCanRespondToEventWithTransitionAndRepairs(): Promise<void>;
|
|
8
|
-
protected static scriptCallbacksCanRespondToEventWithTransitionAndTopicChangers(): Promise<void>;
|
|
9
|
-
protected static scriptCallbackGetsRandAndMessage(): Promise<void>;
|
|
10
|
-
protected static eachPersonGetsTheirOwnConversation(): Promise<void>;
|
|
11
|
-
private static sendMessage;
|
|
12
|
-
private static boot;
|
|
13
|
-
}
|