@sprucelabs/spruce-conversation-plugin 45.2.7 → 46.0.0
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.d.ts +10 -0
- package/build/__tests__/behavioral/CheckingHealth.test.js +87 -0
- package/build/__tests__/behavioral/KillingASkill.test.d.ts +4 -0
- package/build/__tests__/behavioral/KillingASkill.test.js +27 -0
- package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +11 -0
- package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +106 -0
- package/build/__tests__/behavioral/RespondingToMessages.test.d.ts +13 -0
- package/build/__tests__/behavioral/RespondingToMessages.test.js +139 -0
- package/build/__tests__/behavioral/TestingAConversation.test.d.ts +10 -0
- package/build/__tests__/behavioral/TestingAConversation.test.js +70 -0
- package/build/__tests__/implementation/ConversationCoordinator.test.d.ts +15 -0
- package/build/__tests__/implementation/ConversationCoordinator.test.js +142 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +7 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +71 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +4 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +42 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +7 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +71 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +6 -0
- package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +46 -0
- package/build/__tests__/implementation/ScriptTester.test.d.ts +18 -0
- package/build/__tests__/implementation/ScriptTester.test.js +459 -0
- package/build/__tests__/implementation/SuggesterUtil.test.d.ts +7 -0
- package/build/__tests__/implementation/SuggesterUtil.test.js +63 -0
- package/build/__tests__/implementation/TopicLoader.test.d.ts +8 -0
- package/build/__tests__/implementation/TopicLoader.test.js +66 -0
- package/build/__tests__/implementation/TopicScriptPlayer.test.d.ts +21 -0
- package/build/__tests__/implementation/TopicScriptPlayer.test.js +413 -0
- package/build/__tests__/implementation/TopicSuggester.test.d.ts +8 -0
- package/build/__tests__/implementation/TopicSuggester.test.js +131 -0
- package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
- package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +1 -0
- package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +4 -0
- package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.js +3 -0
- package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +4 -0
- package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.js +3 -0
- package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +8 -0
- package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +8 -0
- package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.js +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +8 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +8 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +18 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +18 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +29 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.js +3 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +22 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +14 -0
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.d.ts +2 -0
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.js +3 -0
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +12 -0
- package/build/esm/__tests__/behavioral/CheckingHealth.test.d.ts +10 -0
- package/build/esm/__tests__/behavioral/CheckingHealth.test.js +104 -0
- package/build/esm/__tests__/behavioral/KillingASkill.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/KillingASkill.test.js +32 -0
- package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +11 -0
- package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +126 -0
- package/build/esm/__tests__/behavioral/RespondingToMessages.test.d.ts +13 -0
- package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +156 -0
- package/build/esm/__tests__/behavioral/TestingAConversation.test.d.ts +10 -0
- package/build/esm/__tests__/behavioral/TestingAConversation.test.js +93 -0
- package/build/esm/__tests__/implementation/ConversationCoordinator.test.d.ts +15 -0
- package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +168 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +7 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +82 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +4 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +47 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +7 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +80 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +6 -0
- package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +55 -0
- package/build/esm/__tests__/implementation/ScriptTester.test.d.ts +18 -0
- package/build/esm/__tests__/implementation/ScriptTester.test.js +465 -0
- package/build/esm/__tests__/implementation/SuggesterUtil.test.d.ts +7 -0
- package/build/esm/__tests__/implementation/SuggesterUtil.test.js +74 -0
- package/build/esm/__tests__/implementation/TopicLoader.test.d.ts +8 -0
- package/build/esm/__tests__/implementation/TopicLoader.test.js +79 -0
- package/build/esm/__tests__/implementation/TopicScriptPlayer.test.d.ts +21 -0
- package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +452 -0
- package/build/esm/__tests__/implementation/TopicSuggester.test.d.ts +8 -0
- package/build/esm/__tests__/implementation/TopicSuggester.test.js +124 -0
- 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 +1 -0
- package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +2 -0
- package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +2 -0
- package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +2 -0
- package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +2 -0
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +6 -0
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +6 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +6 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +6 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +25 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +25 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +36 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +29 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +21 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +3 -0
- package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +10 -0
- package/package.json +10 -10
|
@@ -0,0 +1,18 @@
|
|
|
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({ type: 'text', isRequired: true });
|
|
10
|
+
options.ui.renderLine(answer);
|
|
11
|
+
return {
|
|
12
|
+
transitionConversationTo: 'discovery',
|
|
13
|
+
repairs: ['go', 'team'],
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
exports.default = topicDefinition;
|
|
@@ -0,0 +1,18 @@
|
|
|
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({ type: 'text', isRequired: true });
|
|
10
|
+
options.ui.renderLine(answer);
|
|
11
|
+
return {
|
|
12
|
+
transitionConversationTo: 'discovery',
|
|
13
|
+
topicChangers: ['now', 'this'],
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
exports.default = topicDefinition;
|
package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const topicDefinition = {
|
|
4
|
+
label: 'Cancel appointment',
|
|
5
|
+
utterances: ['Cancel appointment', 'Can i cancel my appointment?', 'cancel'],
|
|
6
|
+
script: [
|
|
7
|
+
() => {
|
|
8
|
+
throw new Error('In Script');
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
exports.default = topicDefinition;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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';
|
|
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
|
+
var _a;
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
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
|
+
var _a, _b;
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
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);
|
|
@@ -0,0 +1,32 @@
|
|
|
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';
|
|
17
|
+
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
18
|
+
export default class KillingASkillTest extends AbstractConversationTest {
|
|
19
|
+
static killingASkillKillsConversation() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
this.cwd = this.resolveTestPath('empty-skill');
|
|
22
|
+
const { skill } = yield this.bootAndRegisterNewSkill({
|
|
23
|
+
name: 'great skill dude!',
|
|
24
|
+
});
|
|
25
|
+
yield skill.kill();
|
|
26
|
+
assert.isFalse(skill.isRunning());
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
__decorate([
|
|
31
|
+
test()
|
|
32
|
+
], KillingASkillTest, "killingASkillKillsConversation", null);
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
private static assertExpectedTopics;
|
|
10
|
+
private static registerAndBoot;
|
|
11
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { test, assert } from '@sprucelabs/test';
|
|
18
|
+
import { errorAssert } from '@sprucelabs/test-utils';
|
|
19
|
+
import plugin from '../../plugins/conversation.plugin.js';
|
|
20
|
+
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
21
|
+
export default class RegisteringConversationsOnBootTest extends AbstractConversationTest {
|
|
22
|
+
static throwsWhenExecutingIfEventPluginMissing() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const skill = yield this.Skill({ plugins: [plugin] });
|
|
25
|
+
const err = yield assert.doesThrowAsync(() => skill.execute());
|
|
26
|
+
errorAssert.assertError(err, 'MISSING_DEPENDENCIES', {
|
|
27
|
+
dependencies: ['event.plugin'],
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static noConvosToStart() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
this.cwd = this.resolveTestPath('empty-skill');
|
|
34
|
+
const topics = yield this.registerAndBoot();
|
|
35
|
+
assert.isLength(topics, 0);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
static registersConvosOnBoot() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
this.cwd = this.resolveTestPath('skill');
|
|
41
|
+
const topics = yield this.registerAndBoot();
|
|
42
|
+
this.assertExpectedTopics(topics);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
static skillShutsDownWhenConvosFailToRegister() {
|
|
46
|
+
const _super = Object.create(null, {
|
|
47
|
+
bootSkill: { get: () => super.bootSkill }
|
|
48
|
+
});
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const { skill } = yield _super.bootSkill.call(this, { shouldSuppressBootErrors: true });
|
|
51
|
+
assert.isFalse(skill.isRunning());
|
|
52
|
+
this.clearSkillBootErrors();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static canBootASecondTime() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
this.cwd = this.resolveTestPath('skill');
|
|
58
|
+
const topics = yield this.registerAndBoot();
|
|
59
|
+
this.assertExpectedTopics(topics);
|
|
60
|
+
const topics2 = yield this.registerAndBoot({
|
|
61
|
+
skillId: process.env.SKILL_ID,
|
|
62
|
+
apiKey: process.env.SKILL_API_KEY,
|
|
63
|
+
});
|
|
64
|
+
this.assertExpectedTopics(topics2);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
static skillCanBootASecondTime() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
this.cwd = this.resolveTestPath('skill');
|
|
70
|
+
yield this.registerAndBoot();
|
|
71
|
+
yield this.registerAndBoot({
|
|
72
|
+
skillId: process.env.SKILL_ID,
|
|
73
|
+
apiKey: process.env.SKILL_API_KEY,
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static assertExpectedTopics(topics) {
|
|
78
|
+
assert.isLength(topics, 5);
|
|
79
|
+
assert.doesInclude(topics, { key: 'bookAppointment' });
|
|
80
|
+
assert.doesInclude(topics, { key: 'cancelAppointment' });
|
|
81
|
+
assert.doesInclude(topics, { key: 'favoriteColor' });
|
|
82
|
+
assert.doesInclude(topics, { key: 'favoriteColorTopicChanger' });
|
|
83
|
+
assert.doesInclude(topics, { key: 'mixedStringsAndCallbacks' });
|
|
84
|
+
}
|
|
85
|
+
static registerAndBoot(options) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
if (options === null || options === void 0 ? void 0 : options.skillId) {
|
|
88
|
+
process.env.SKILL_ID = options.skillId;
|
|
89
|
+
process.env.SKILL_API_KEY = options.apiKey;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const registeredSkill = yield this.Fixture('skill').seedDemoSkill({
|
|
93
|
+
name: 'my great skill',
|
|
94
|
+
});
|
|
95
|
+
process.env.SKILL_ID = registeredSkill.id;
|
|
96
|
+
process.env.SKILL_API_KEY = registeredSkill.apiKey;
|
|
97
|
+
}
|
|
98
|
+
const { skill } = yield this.bootSkill();
|
|
99
|
+
const eventFeature = skill.getFeatureByCode('event');
|
|
100
|
+
const client = yield eventFeature.connectToApi();
|
|
101
|
+
let topics;
|
|
102
|
+
const results = yield client.emit('get-conversation-topics::v2020_12_25');
|
|
103
|
+
const payload = eventResponseUtil.getFirstResponseOrThrow(results);
|
|
104
|
+
topics = payload.topics;
|
|
105
|
+
return topics;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
__decorate([
|
|
110
|
+
test()
|
|
111
|
+
], RegisteringConversationsOnBootTest, "throwsWhenExecutingIfEventPluginMissing", null);
|
|
112
|
+
__decorate([
|
|
113
|
+
test()
|
|
114
|
+
], RegisteringConversationsOnBootTest, "noConvosToStart", null);
|
|
115
|
+
__decorate([
|
|
116
|
+
test()
|
|
117
|
+
], RegisteringConversationsOnBootTest, "registersConvosOnBoot", null);
|
|
118
|
+
__decorate([
|
|
119
|
+
test()
|
|
120
|
+
], RegisteringConversationsOnBootTest, "skillShutsDownWhenConvosFailToRegister", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
test()
|
|
123
|
+
], RegisteringConversationsOnBootTest, "canBootASecondTime", null);
|
|
124
|
+
__decorate([
|
|
125
|
+
test()
|
|
126
|
+
], RegisteringConversationsOnBootTest, "skillCanBootASecondTime", null);
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
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 { test, assert } from '@sprucelabs/test';
|
|
18
|
+
import AbstractConversationTest from '../../tests/AbstractConversationTest.js';
|
|
19
|
+
export default class RespondingToMessagesTest extends AbstractConversationTest {
|
|
20
|
+
static beforeEach() {
|
|
21
|
+
const _super = Object.create(null, {
|
|
22
|
+
beforeEach: { get: () => super.beforeEach }
|
|
23
|
+
});
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield _super.beforeEach.call(this);
|
|
26
|
+
//@ts-ignore
|
|
27
|
+
this.client = undefined;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static respondsToFirstMessageWithSuggestedTopics() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
this.cwd = this.resolveTestPath('skill');
|
|
33
|
+
const results = yield this.sendMessage();
|
|
34
|
+
const { suggestedTopics } = eventResponseUtil.getFirstResponseOrThrow(results);
|
|
35
|
+
assert.isArray(suggestedTopics);
|
|
36
|
+
assert.isLength(suggestedTopics, 1);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
static scriptSendsMessages() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
this.cwd = this.resolveTestPath('skill');
|
|
42
|
+
const sentMessages = [];
|
|
43
|
+
yield this.boot();
|
|
44
|
+
yield this.client.on('send-message::v2020_12_25', (targetAndPayload) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const { payload } = targetAndPayload;
|
|
46
|
+
sentMessages.push(payload.message);
|
|
47
|
+
return { message: payload.message };
|
|
48
|
+
}));
|
|
49
|
+
yield this.sendMessage({ topic: 'bookAppointment' });
|
|
50
|
+
assert.isLength(sentMessages, 2);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static scriptCallbacksCanRespondToEventWithTransitionAndRepairs() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
this.cwd = this.resolveTestPath('skill');
|
|
56
|
+
yield this.sendMessage({
|
|
57
|
+
topic: 'favoriteColor',
|
|
58
|
+
message: { body: 'favorite color' },
|
|
59
|
+
});
|
|
60
|
+
const results = yield this.sendMessage({
|
|
61
|
+
topic: 'favoriteColor',
|
|
62
|
+
message: { body: 'blue' },
|
|
63
|
+
});
|
|
64
|
+
const { transitionConversationTo, repairs } = eventResponseUtil.getFirstResponseOrThrow(results);
|
|
65
|
+
assert.isEqual(transitionConversationTo, 'discovery');
|
|
66
|
+
assert.isEqualDeep(repairs, ['go', 'team']);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
static scriptCallbacksCanRespondToEventWithTransitionAndTopicChangers() {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
this.cwd = this.resolveTestPath('skill');
|
|
72
|
+
yield this.sendMessage({
|
|
73
|
+
topic: 'favoriteColorTopicChanger',
|
|
74
|
+
message: { body: 'favorite color' },
|
|
75
|
+
});
|
|
76
|
+
const results = yield this.sendMessage({
|
|
77
|
+
topic: 'favoriteColorTopicChanger',
|
|
78
|
+
message: { body: 'blue' },
|
|
79
|
+
});
|
|
80
|
+
const { transitionConversationTo, topicChangers } = eventResponseUtil.getFirstResponseOrThrow(results);
|
|
81
|
+
assert.isEqual(transitionConversationTo, 'discovery');
|
|
82
|
+
assert.isEqualDeep(topicChangers, ['now', 'this']);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
static scriptCallbackGetsRandAndMessage() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
this.cwd = this.resolveTestPath('skill-assertions');
|
|
88
|
+
const results = yield this.sendMessage({
|
|
89
|
+
topic: 'assertsScriptCallbackOptions',
|
|
90
|
+
message: { body: 'hello' },
|
|
91
|
+
});
|
|
92
|
+
eventResponseUtil.getFirstResponseOrThrow(results);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
static eachPersonGetsTheirOwnConversation() {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
this.cwd = this.resolveTestPath('skill-assertions');
|
|
98
|
+
yield this.sendMessage({
|
|
99
|
+
topic: 'assertsScriptOnlyCalledOnce',
|
|
100
|
+
message: { body: 'hey hey', source: { personId: '234234234' } },
|
|
101
|
+
});
|
|
102
|
+
yield this.sendMessage({
|
|
103
|
+
topic: 'assertsScriptOnlyCalledOnce',
|
|
104
|
+
message: { body: 'hey hey', source: { personId: '234234' } },
|
|
105
|
+
});
|
|
106
|
+
yield this.sendMessage({
|
|
107
|
+
topic: 'assertsScriptOnlyCalledOnce',
|
|
108
|
+
message: { body: 'hey hey', source: { personId: '323' } },
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static sendMessage(options) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const client = yield this.boot();
|
|
115
|
+
const results = yield client.emit('did-message::v2020_12_25', {
|
|
116
|
+
target: {},
|
|
117
|
+
payload: Object.assign(Object.assign({}, options), { message: this.buildMessage(Object.assign({ body: 'I wanna book an appointment!', source: {
|
|
118
|
+
isCore: null,
|
|
119
|
+
personId: '12345',
|
|
120
|
+
} }, options === null || options === void 0 ? void 0 : options.message)) }),
|
|
121
|
+
});
|
|
122
|
+
return results;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
static boot() {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (!this.client) {
|
|
128
|
+
const { skill } = yield this.bootAndRegisterNewSkill({
|
|
129
|
+
name: 'my skill yo',
|
|
130
|
+
});
|
|
131
|
+
const events = skill.getFeatureByCode('event');
|
|
132
|
+
const client = yield events.connectToApi();
|
|
133
|
+
this.client = client;
|
|
134
|
+
}
|
|
135
|
+
return this.client;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
__decorate([
|
|
140
|
+
test()
|
|
141
|
+
], RespondingToMessagesTest, "respondsToFirstMessageWithSuggestedTopics", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
test()
|
|
144
|
+
], RespondingToMessagesTest, "scriptSendsMessages", null);
|
|
145
|
+
__decorate([
|
|
146
|
+
test()
|
|
147
|
+
], RespondingToMessagesTest, "scriptCallbacksCanRespondToEventWithTransitionAndRepairs", null);
|
|
148
|
+
__decorate([
|
|
149
|
+
test()
|
|
150
|
+
], RespondingToMessagesTest, "scriptCallbacksCanRespondToEventWithTransitionAndTopicChangers", null);
|
|
151
|
+
__decorate([
|
|
152
|
+
test()
|
|
153
|
+
], RespondingToMessagesTest, "scriptCallbackGetsRandAndMessage", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
test()
|
|
156
|
+
], RespondingToMessagesTest, "eachPersonGetsTheirOwnConversation", null);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AbstractConversationTest from '../../tests/AbstractConversationTest';
|
|
2
|
+
export default class TestingAConversationTest extends AbstractConversationTest {
|
|
3
|
+
protected static afterEach(): Promise<void>;
|
|
4
|
+
protected static afterAll(): Promise<void>;
|
|
5
|
+
protected static bootingNormallyDoesNotGoToTestMode(): Promise<void>;
|
|
6
|
+
protected static bootsInTestModeWithProperAction(): Promise<void>;
|
|
7
|
+
protected static throwsWithBadScript(): Promise<void>;
|
|
8
|
+
protected static throwsWithThrowsInScript(): Promise<void>;
|
|
9
|
+
private static bootAndGetConversationFeature;
|
|
10
|
+
}
|