@sprucelabs/spruce-conversation-plugin 45.2.8 → 46.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/build/__tests__/behavioral/CheckingHealth.test.d.ts +10 -0
  2. package/build/__tests__/behavioral/CheckingHealth.test.js +87 -0
  3. package/build/__tests__/behavioral/KillingASkill.test.d.ts +4 -0
  4. package/build/__tests__/behavioral/KillingASkill.test.js +27 -0
  5. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +11 -0
  6. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +106 -0
  7. package/build/__tests__/behavioral/RespondingToMessages.test.d.ts +13 -0
  8. package/build/__tests__/behavioral/RespondingToMessages.test.js +139 -0
  9. package/build/__tests__/behavioral/TestingAConversation.test.d.ts +10 -0
  10. package/build/__tests__/behavioral/TestingAConversation.test.js +70 -0
  11. package/build/__tests__/implementation/ConversationCoordinator.test.d.ts +15 -0
  12. package/build/__tests__/implementation/ConversationCoordinator.test.js +142 -0
  13. package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +7 -0
  14. package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +71 -0
  15. package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +4 -0
  16. package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +42 -0
  17. package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +7 -0
  18. package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +71 -0
  19. package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +6 -0
  20. package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +46 -0
  21. package/build/__tests__/implementation/ScriptTester.test.d.ts +18 -0
  22. package/build/__tests__/implementation/ScriptTester.test.js +459 -0
  23. package/build/__tests__/implementation/SuggesterUtil.test.d.ts +7 -0
  24. package/build/__tests__/implementation/SuggesterUtil.test.js +63 -0
  25. package/build/__tests__/implementation/TopicLoader.test.d.ts +8 -0
  26. package/build/__tests__/implementation/TopicLoader.test.js +66 -0
  27. package/build/__tests__/implementation/TopicScriptPlayer.test.d.ts +21 -0
  28. package/build/__tests__/implementation/TopicScriptPlayer.test.js +413 -0
  29. package/build/__tests__/implementation/TopicSuggester.test.d.ts +8 -0
  30. package/build/__tests__/implementation/TopicSuggester.test.js +131 -0
  31. package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
  32. package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +1 -0
  33. package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +2 -0
  34. package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +4 -0
  35. package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.d.ts +2 -0
  36. package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.js +3 -0
  37. package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +2 -0
  38. package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +4 -0
  39. package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.d.ts +2 -0
  40. package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.js +3 -0
  41. package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +3 -0
  42. package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +8 -0
  43. package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +3 -0
  44. package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +8 -0
  45. package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.d.ts +2 -0
  46. package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.js +3 -0
  47. package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +3 -0
  48. package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +8 -0
  49. package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +3 -0
  50. package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +8 -0
  51. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +3 -0
  52. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +18 -0
  53. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +3 -0
  54. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +18 -0
  55. package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +3 -0
  56. package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +29 -0
  57. package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.d.ts +2 -0
  58. package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.js +3 -0
  59. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +3 -0
  60. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +22 -0
  61. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +3 -0
  62. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +14 -0
  63. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.d.ts +2 -0
  64. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.js +3 -0
  65. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +3 -0
  66. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +12 -0
  67. package/build/esm/__tests__/behavioral/CheckingHealth.test.d.ts +10 -0
  68. package/build/esm/__tests__/behavioral/CheckingHealth.test.js +104 -0
  69. package/build/esm/__tests__/behavioral/KillingASkill.test.d.ts +4 -0
  70. package/build/esm/__tests__/behavioral/KillingASkill.test.js +32 -0
  71. package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +11 -0
  72. package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +126 -0
  73. package/build/esm/__tests__/behavioral/RespondingToMessages.test.d.ts +13 -0
  74. package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +156 -0
  75. package/build/esm/__tests__/behavioral/TestingAConversation.test.d.ts +10 -0
  76. package/build/esm/__tests__/behavioral/TestingAConversation.test.js +93 -0
  77. package/build/esm/__tests__/implementation/ConversationCoordinator.test.d.ts +15 -0
  78. package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +168 -0
  79. package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +7 -0
  80. package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +82 -0
  81. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +4 -0
  82. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +47 -0
  83. package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +7 -0
  84. package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +80 -0
  85. package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +6 -0
  86. package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +55 -0
  87. package/build/esm/__tests__/implementation/ScriptTester.test.d.ts +18 -0
  88. package/build/esm/__tests__/implementation/ScriptTester.test.js +465 -0
  89. package/build/esm/__tests__/implementation/SuggesterUtil.test.d.ts +7 -0
  90. package/build/esm/__tests__/implementation/SuggesterUtil.test.js +74 -0
  91. package/build/esm/__tests__/implementation/TopicLoader.test.d.ts +8 -0
  92. package/build/esm/__tests__/implementation/TopicLoader.test.js +79 -0
  93. package/build/esm/__tests__/implementation/TopicScriptPlayer.test.d.ts +21 -0
  94. package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +452 -0
  95. package/build/esm/__tests__/implementation/TopicSuggester.test.d.ts +8 -0
  96. package/build/esm/__tests__/implementation/TopicSuggester.test.js +124 -0
  97. package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
  98. package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +1 -0
  99. package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +2 -0
  100. package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +2 -0
  101. package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +2 -0
  102. package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +2 -0
  103. package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +3 -0
  104. package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +6 -0
  105. package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +3 -0
  106. package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +6 -0
  107. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +3 -0
  108. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +6 -0
  109. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +3 -0
  110. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +6 -0
  111. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +3 -0
  112. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +25 -0
  113. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +3 -0
  114. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +25 -0
  115. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +3 -0
  116. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +36 -0
  117. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +3 -0
  118. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +29 -0
  119. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +3 -0
  120. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +21 -0
  121. package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +3 -0
  122. package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +10 -0
  123. package/package.json +10 -10
@@ -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,87 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const test_utils_1 = require("@sprucelabs/test-utils");
14
+ const conversation_plugin_1 = __importDefault(require("../../plugins/conversation.plugin"));
15
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
16
+ class CheckingHealthTest extends AbstractConversationTest_1.default {
17
+ static async pluginReturnsInstance() {
18
+ test_1.assert.isTrue(conversation_plugin_1.default instanceof Function);
19
+ }
20
+ static async registersWithSkill() {
21
+ const skill = await this.Skill();
22
+ const features = skill.getFeatures();
23
+ test_1.assert.isLength(features, 2);
24
+ }
25
+ static async throwsWhenExecutingIfEventPluginMissing() {
26
+ var _a;
27
+ const health = await this.checkHealth({ plugins: [conversation_plugin_1.default] });
28
+ test_1.assert.isTruthy(health.conversation);
29
+ test_1.assert.isEqual(health.conversation.status, 'failed');
30
+ const err = (_a = health.conversation.errors) === null || _a === void 0 ? void 0 : _a[0];
31
+ test_1.assert.isTruthy(err);
32
+ test_utils_1.errorAssert.assertError(err, 'MISSING_DEPENDENCIES', {
33
+ dependencies: ['event.plugin'],
34
+ });
35
+ }
36
+ static async returnsZeroStateResponseFromHealthCheckWhenNoConversations() {
37
+ const healthCheck = await this.checkHealth();
38
+ test_1.assert.isTruthy(healthCheck.conversation);
39
+ test_1.assert.isEqual(healthCheck.conversation.status, 'passed');
40
+ test_1.assert.isEqualDeep(healthCheck.conversation.topics, []);
41
+ }
42
+ static async checkHealth(options) {
43
+ const skill = await this.Skill(options);
44
+ const healthCheck = await skill.checkHealth();
45
+ return healthCheck;
46
+ }
47
+ static async returnsHelpfulErrorWHenPassedBadConvos() {
48
+ var _a, _b;
49
+ const healthCheck = await this.checkHealth({
50
+ activeDir: this.resolvePath(__dirname, '..', 'testDirsAndFiles', 'bad-missing-params'),
51
+ });
52
+ test_1.assert.isTruthy(healthCheck.conversation);
53
+ test_1.assert.isEqual(healthCheck.conversation.status, 'failed');
54
+ test_utils_1.errorAssert.assertError((_a = healthCheck.conversation.errors) === null || _a === void 0 ? void 0 : _a[0], 'CONVERSATION_PLUGIN_ERROR');
55
+ test_utils_1.errorAssert.assertError((_b = healthCheck.conversation.errors) === null || _b === void 0 ? void 0 : _b[0].originalError, 'INVALID_TOPIC');
56
+ }
57
+ static async getsTopicsFromHealthCheck() {
58
+ const healthCheck = await this.checkHealth({
59
+ activeDir: this.resolvePath(__dirname, '..', 'testDirsAndFiles', 'good'),
60
+ });
61
+ test_1.assert.isTruthy(healthCheck.conversation);
62
+ test_1.assert.isLength(healthCheck.conversation.topics, 2);
63
+ test_1.assert.isEqualDeep(healthCheck.conversation.topics, [
64
+ 'bookAppointment',
65
+ 'cancelAppointment',
66
+ ]);
67
+ }
68
+ }
69
+ __decorate([
70
+ (0, test_1.test)()
71
+ ], CheckingHealthTest, "pluginReturnsInstance", null);
72
+ __decorate([
73
+ (0, test_1.test)()
74
+ ], CheckingHealthTest, "registersWithSkill", null);
75
+ __decorate([
76
+ (0, test_1.test)()
77
+ ], CheckingHealthTest, "throwsWhenExecutingIfEventPluginMissing", null);
78
+ __decorate([
79
+ (0, test_1.test)()
80
+ ], CheckingHealthTest, "returnsZeroStateResponseFromHealthCheckWhenNoConversations", null);
81
+ __decorate([
82
+ (0, test_1.test)()
83
+ ], CheckingHealthTest, "returnsHelpfulErrorWHenPassedBadConvos", null);
84
+ __decorate([
85
+ (0, test_1.test)()
86
+ ], CheckingHealthTest, "getsTopicsFromHealthCheck", null);
87
+ exports.default = CheckingHealthTest;
@@ -0,0 +1,4 @@
1
+ import AbstractConversationTest from '../../tests/AbstractConversationTest';
2
+ export default class KillingASkillTest extends AbstractConversationTest {
3
+ protected static killingASkillKillsConversation(): Promise<void>;
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
14
+ class KillingASkillTest extends AbstractConversationTest_1.default {
15
+ static async killingASkillKillsConversation() {
16
+ this.cwd = this.resolveTestPath('empty-skill');
17
+ const { skill } = await this.bootAndRegisterNewSkill({
18
+ name: 'great skill dude!',
19
+ });
20
+ await skill.kill();
21
+ test_1.assert.isFalse(skill.isRunning());
22
+ }
23
+ }
24
+ __decorate([
25
+ (0, test_1.test)()
26
+ ], KillingASkillTest, "killingASkillKillsConversation", null);
27
+ exports.default = KillingASkillTest;
@@ -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,106 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
13
+ const test_1 = require("@sprucelabs/test");
14
+ const test_utils_1 = require("@sprucelabs/test-utils");
15
+ const conversation_plugin_1 = __importDefault(require("../../plugins/conversation.plugin"));
16
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
17
+ class RegisteringConversationsOnBootTest extends AbstractConversationTest_1.default {
18
+ static async throwsWhenExecutingIfEventPluginMissing() {
19
+ const skill = await this.Skill({ plugins: [conversation_plugin_1.default] });
20
+ const err = await test_1.assert.doesThrowAsync(() => skill.execute());
21
+ test_utils_1.errorAssert.assertError(err, 'MISSING_DEPENDENCIES', {
22
+ dependencies: ['event.plugin'],
23
+ });
24
+ }
25
+ static async noConvosToStart() {
26
+ this.cwd = this.resolveTestPath('empty-skill');
27
+ const topics = await this.registerAndBoot();
28
+ test_1.assert.isLength(topics, 0);
29
+ }
30
+ static async registersConvosOnBoot() {
31
+ this.cwd = this.resolveTestPath('skill');
32
+ const topics = await this.registerAndBoot();
33
+ this.assertExpectedTopics(topics);
34
+ }
35
+ static async skillShutsDownWhenConvosFailToRegister() {
36
+ const { skill } = await super.bootSkill({ shouldSuppressBootErrors: true });
37
+ test_1.assert.isFalse(skill.isRunning());
38
+ this.clearSkillBootErrors();
39
+ }
40
+ static async canBootASecondTime() {
41
+ this.cwd = this.resolveTestPath('skill');
42
+ const topics = await this.registerAndBoot();
43
+ this.assertExpectedTopics(topics);
44
+ const topics2 = await this.registerAndBoot({
45
+ skillId: process.env.SKILL_ID,
46
+ apiKey: process.env.SKILL_API_KEY,
47
+ });
48
+ this.assertExpectedTopics(topics2);
49
+ }
50
+ static async skillCanBootASecondTime() {
51
+ this.cwd = this.resolveTestPath('skill');
52
+ await this.registerAndBoot();
53
+ await this.registerAndBoot({
54
+ skillId: process.env.SKILL_ID,
55
+ apiKey: process.env.SKILL_API_KEY,
56
+ });
57
+ }
58
+ static assertExpectedTopics(topics) {
59
+ test_1.assert.isLength(topics, 5);
60
+ test_1.assert.doesInclude(topics, { key: 'bookAppointment' });
61
+ test_1.assert.doesInclude(topics, { key: 'cancelAppointment' });
62
+ test_1.assert.doesInclude(topics, { key: 'favoriteColor' });
63
+ test_1.assert.doesInclude(topics, { key: 'favoriteColorTopicChanger' });
64
+ test_1.assert.doesInclude(topics, { key: 'mixedStringsAndCallbacks' });
65
+ }
66
+ static async registerAndBoot(options) {
67
+ if (options === null || options === void 0 ? void 0 : options.skillId) {
68
+ process.env.SKILL_ID = options.skillId;
69
+ process.env.SKILL_API_KEY = options.apiKey;
70
+ }
71
+ else {
72
+ const registeredSkill = await this.Fixture('skill').seedDemoSkill({
73
+ name: 'my great skill',
74
+ });
75
+ process.env.SKILL_ID = registeredSkill.id;
76
+ process.env.SKILL_API_KEY = registeredSkill.apiKey;
77
+ }
78
+ const { skill } = await this.bootSkill();
79
+ const eventFeature = skill.getFeatureByCode('event');
80
+ const client = await eventFeature.connectToApi();
81
+ let topics;
82
+ const results = await client.emit('get-conversation-topics::v2020_12_25');
83
+ const payload = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
84
+ topics = payload.topics;
85
+ return topics;
86
+ }
87
+ }
88
+ __decorate([
89
+ (0, test_1.test)()
90
+ ], RegisteringConversationsOnBootTest, "throwsWhenExecutingIfEventPluginMissing", null);
91
+ __decorate([
92
+ (0, test_1.test)()
93
+ ], RegisteringConversationsOnBootTest, "noConvosToStart", null);
94
+ __decorate([
95
+ (0, test_1.test)()
96
+ ], RegisteringConversationsOnBootTest, "registersConvosOnBoot", null);
97
+ __decorate([
98
+ (0, test_1.test)()
99
+ ], RegisteringConversationsOnBootTest, "skillShutsDownWhenConvosFailToRegister", null);
100
+ __decorate([
101
+ (0, test_1.test)()
102
+ ], RegisteringConversationsOnBootTest, "canBootASecondTime", null);
103
+ __decorate([
104
+ (0, test_1.test)()
105
+ ], RegisteringConversationsOnBootTest, "skillCanBootASecondTime", null);
106
+ exports.default = RegisteringConversationsOnBootTest;
@@ -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,139 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
13
+ const test_1 = require("@sprucelabs/test");
14
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
15
+ class RespondingToMessagesTest extends AbstractConversationTest_1.default {
16
+ static async beforeEach() {
17
+ await super.beforeEach();
18
+ //@ts-ignore
19
+ this.client = undefined;
20
+ }
21
+ static async respondsToFirstMessageWithSuggestedTopics() {
22
+ this.cwd = this.resolveTestPath('skill');
23
+ const results = await this.sendMessage();
24
+ const { suggestedTopics } = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
25
+ test_1.assert.isArray(suggestedTopics);
26
+ test_1.assert.isLength(suggestedTopics, 1);
27
+ }
28
+ static async scriptSendsMessages() {
29
+ this.cwd = this.resolveTestPath('skill');
30
+ const sentMessages = [];
31
+ await this.boot();
32
+ await this.client.on('send-message::v2020_12_25', async (targetAndPayload) => {
33
+ const { payload } = targetAndPayload;
34
+ sentMessages.push(payload.message);
35
+ return { message: payload.message };
36
+ });
37
+ await this.sendMessage({ topic: 'bookAppointment' });
38
+ test_1.assert.isLength(sentMessages, 2);
39
+ }
40
+ static async scriptCallbacksCanRespondToEventWithTransitionAndRepairs() {
41
+ this.cwd = this.resolveTestPath('skill');
42
+ await this.sendMessage({
43
+ topic: 'favoriteColor',
44
+ message: { body: 'favorite color' },
45
+ });
46
+ const results = await this.sendMessage({
47
+ topic: 'favoriteColor',
48
+ message: { body: 'blue' },
49
+ });
50
+ const { transitionConversationTo, repairs } = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
51
+ test_1.assert.isEqual(transitionConversationTo, 'discovery');
52
+ test_1.assert.isEqualDeep(repairs, ['go', 'team']);
53
+ }
54
+ static async scriptCallbacksCanRespondToEventWithTransitionAndTopicChangers() {
55
+ this.cwd = this.resolveTestPath('skill');
56
+ await this.sendMessage({
57
+ topic: 'favoriteColorTopicChanger',
58
+ message: { body: 'favorite color' },
59
+ });
60
+ const results = await this.sendMessage({
61
+ topic: 'favoriteColorTopicChanger',
62
+ message: { body: 'blue' },
63
+ });
64
+ const { transitionConversationTo, topicChangers } = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
65
+ test_1.assert.isEqual(transitionConversationTo, 'discovery');
66
+ test_1.assert.isEqualDeep(topicChangers, ['now', 'this']);
67
+ }
68
+ static async scriptCallbackGetsRandAndMessage() {
69
+ this.cwd = this.resolveTestPath('skill-assertions');
70
+ const results = await this.sendMessage({
71
+ topic: 'assertsScriptCallbackOptions',
72
+ message: { body: 'hello' },
73
+ });
74
+ spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
75
+ }
76
+ static async eachPersonGetsTheirOwnConversation() {
77
+ this.cwd = this.resolveTestPath('skill-assertions');
78
+ await this.sendMessage({
79
+ topic: 'assertsScriptOnlyCalledOnce',
80
+ message: { body: 'hey hey', source: { personId: '234234234' } },
81
+ });
82
+ await this.sendMessage({
83
+ topic: 'assertsScriptOnlyCalledOnce',
84
+ message: { body: 'hey hey', source: { personId: '234234' } },
85
+ });
86
+ await this.sendMessage({
87
+ topic: 'assertsScriptOnlyCalledOnce',
88
+ message: { body: 'hey hey', source: { personId: '323' } },
89
+ });
90
+ }
91
+ static async sendMessage(options) {
92
+ const client = await this.boot();
93
+ const results = await client.emit('did-message::v2020_12_25', {
94
+ target: {},
95
+ payload: {
96
+ ...options,
97
+ message: this.buildMessage({
98
+ body: 'I wanna book an appointment!',
99
+ source: {
100
+ isCore: null,
101
+ personId: '12345',
102
+ },
103
+ ...options === null || options === void 0 ? void 0 : options.message,
104
+ }),
105
+ },
106
+ });
107
+ return results;
108
+ }
109
+ static async boot() {
110
+ if (!this.client) {
111
+ const { skill } = await this.bootAndRegisterNewSkill({
112
+ name: 'my skill yo',
113
+ });
114
+ const events = skill.getFeatureByCode('event');
115
+ const client = await events.connectToApi();
116
+ this.client = client;
117
+ }
118
+ return this.client;
119
+ }
120
+ }
121
+ __decorate([
122
+ (0, test_1.test)()
123
+ ], RespondingToMessagesTest, "respondsToFirstMessageWithSuggestedTopics", null);
124
+ __decorate([
125
+ (0, test_1.test)()
126
+ ], RespondingToMessagesTest, "scriptSendsMessages", null);
127
+ __decorate([
128
+ (0, test_1.test)()
129
+ ], RespondingToMessagesTest, "scriptCallbacksCanRespondToEventWithTransitionAndRepairs", null);
130
+ __decorate([
131
+ (0, test_1.test)()
132
+ ], RespondingToMessagesTest, "scriptCallbacksCanRespondToEventWithTransitionAndTopicChangers", null);
133
+ __decorate([
134
+ (0, test_1.test)()
135
+ ], RespondingToMessagesTest, "scriptCallbackGetsRandAndMessage", null);
136
+ __decorate([
137
+ (0, test_1.test)()
138
+ ], RespondingToMessagesTest, "eachPersonGetsTheirOwnConversation", null);
139
+ exports.default = RespondingToMessagesTest;
@@ -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
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const test_utils_1 = require("@sprucelabs/test-utils");
14
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
15
+ class TestingAConversationTest extends AbstractConversationTest_1.default {
16
+ static async afterEach() {
17
+ await super.afterEach();
18
+ process.env.ACTION = undefined;
19
+ }
20
+ static async afterAll() {
21
+ await super.afterAll();
22
+ process.env.ACTION = undefined;
23
+ }
24
+ static async bootingNormallyDoesNotGoToTestMode() {
25
+ this.cwd = this.resolveTestPath('empty-skill');
26
+ const conversation = await this.bootAndGetConversationFeature({
27
+ shouldSuppressBootErrors: true,
28
+ });
29
+ test_1.assert.isFalse(conversation.isTesting());
30
+ this.clearSkillBootErrors();
31
+ }
32
+ static async bootsInTestModeWithProperAction() {
33
+ process.env.ACTION = 'test.conversation';
34
+ const conversation = await this.bootAndGetConversationFeature();
35
+ test_1.assert.isTrue(conversation.isTesting());
36
+ }
37
+ static async throwsWithBadScript() {
38
+ this.cwd = this.resolveTestPath('bad-skill');
39
+ process.env.ACTION = 'test.conversation';
40
+ const skill = await this.Skill();
41
+ const err = await test_1.assert.doesThrowAsync(() => skill.execute());
42
+ test_utils_1.errorAssert.assertError(err, 'INVALID_TOPIC');
43
+ }
44
+ static async throwsWithThrowsInScript() {
45
+ this.cwd = this.resolveTestPath('skill-with-script-that-throws');
46
+ process.env.ACTION = 'test.conversation';
47
+ process.env.FIRST_MESSAGE = 'hey there!';
48
+ const skill = await this.Skill();
49
+ const err = await test_1.assert.doesThrowAsync(() => skill.execute());
50
+ test_utils_1.errorAssert.assertError(err, 'CONVERSATION_ABORTED');
51
+ }
52
+ static async bootAndGetConversationFeature(options) {
53
+ const { skill } = await this.bootSkill(options);
54
+ const conversation = skill.getFeatureByCode('conversation');
55
+ return conversation;
56
+ }
57
+ }
58
+ __decorate([
59
+ (0, test_1.test)()
60
+ ], TestingAConversationTest, "bootingNormallyDoesNotGoToTestMode", null);
61
+ __decorate([
62
+ (0, test_1.test)()
63
+ ], TestingAConversationTest, "bootsInTestModeWithProperAction", null);
64
+ __decorate([
65
+ (0, test_1.test)()
66
+ ], TestingAConversationTest, "throwsWithBadScript", null);
67
+ __decorate([
68
+ (0, test_1.test)()
69
+ ], TestingAConversationTest, "throwsWithThrowsInScript", null);
70
+ exports.default = TestingAConversationTest;
@@ -0,0 +1,15 @@
1
+ import AbstractConversationTest from '../../tests/AbstractConversationTest';
2
+ export default class TopicCoordinatorTest extends AbstractConversationTest {
3
+ private static coordinator;
4
+ private static sentMessages;
5
+ protected static beforeEach(): Promise<void>;
6
+ protected static canCreateTopicCoordinator(): Promise<void>;
7
+ protected static hasHandleMessage(): Promise<void>;
8
+ protected static handledMessageMustHaveASource(): Promise<void>;
9
+ protected static respondsWithSuggestedTopicsToFirstMessage(): Promise<void>;
10
+ protected static handlesNoSkillWithTopics(): Promise<void>;
11
+ protected static throwsWhenSentBadTopic(): Promise<void>;
12
+ protected static playsScriptWhenTopicIsSelected(): Promise<void>;
13
+ protected static canHandlePromptsInScript(): Promise<void>;
14
+ protected static canPlaceMixedScriptsUntilTheEndAndStartsOver(): Promise<void>;
15
+ }
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const test_utils_1 = require("@sprucelabs/test-utils");
14
+ const ConversationCoordinator_1 = require("../../conversations/ConversationCoordinator");
15
+ const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
16
+ class TopicCoordinatorTest extends AbstractConversationTest_1.default {
17
+ static async beforeEach() {
18
+ await super.beforeEach();
19
+ this.sentMessages = [];
20
+ this.coordinator = await ConversationCoordinator_1.ConversationCoordinator.Coordinator({
21
+ lineDelay: 0,
22
+ sendMessageHandler: async (message) => {
23
+ this.sentMessages.push(message);
24
+ },
25
+ topicLookupPath: this.resolveTestPath('skill', 'build'),
26
+ });
27
+ }
28
+ static async canCreateTopicCoordinator() {
29
+ test_1.assert.isTruthy(this.coordinator);
30
+ }
31
+ static async hasHandleMessage() {
32
+ test_1.assert.isFunction(this.coordinator.handleMessage);
33
+ }
34
+ static async handledMessageMustHaveASource() {
35
+ const err = await test_1.assert.doesThrowAsync(() => this.coordinator.handleMessage(this.buildMessage({ body: 'waka waka' })));
36
+ test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
37
+ parameters: ['source.personId'],
38
+ });
39
+ }
40
+ static async respondsWithSuggestedTopicsToFirstMessage() {
41
+ const results = await this.coordinator.handleMessage(this.buildMessage({ body: 'help me book!', source: { personId: '1234' } }));
42
+ test_1.assert.isArray(results.suggestedTopics);
43
+ test_1.assert.isLength(results.suggestedTopics, 3);
44
+ }
45
+ static async handlesNoSkillWithTopics() {
46
+ const coordinator = await ConversationCoordinator_1.ConversationCoordinator.Coordinator({
47
+ topicLookupPath: this.cwd,
48
+ sendMessageHandler: async () => { },
49
+ });
50
+ const results = await coordinator.handleMessage(this.buildMessage({ body: 'help me book!', source: { personId: '1234' } }));
51
+ test_1.assert.isArray(results.suggestedTopics);
52
+ test_1.assert.isLength(results.suggestedTopics, 0);
53
+ }
54
+ static async throwsWhenSentBadTopic() {
55
+ const err = await test_1.assert.doesThrowAsync(() => this.coordinator.handleMessage(this.buildMessage({ body: '1', source: { personId: '1234' } }), 'aoeu'));
56
+ test_utils_1.errorAssert.assertError(err, 'TOPIC_NOT_FOUND', {
57
+ suppliedTopic: 'aoeu',
58
+ validTopics: [
59
+ 'bookAppointment',
60
+ 'cancelAppointment',
61
+ 'favoriteColor',
62
+ 'favoriteColorTopicChanger',
63
+ 'mixedStringsAndCallbacks',
64
+ ],
65
+ });
66
+ }
67
+ static async playsScriptWhenTopicIsSelected() {
68
+ await this.coordinator.handleMessage(this.buildMessage({ body: '1', source: { personId: '1234' } }), 'bookAppointment');
69
+ test_1.assert.isLength(this.sentMessages, 2);
70
+ test_1.assert.isEqual(this.sentMessages[0].body, 'Sweet, lets book!');
71
+ }
72
+ static async canHandlePromptsInScript() {
73
+ var _a;
74
+ void this.coordinator.handleMessage(this.buildMessage({ body: '1', source: { personId: '1234' } }), 'favoriteColor');
75
+ await this.wait(10);
76
+ test_1.assert.isLength(this.sentMessages, 1);
77
+ test_1.assert.isEqual(this.sentMessages[0].body, 'what is your favorite color?');
78
+ void this.coordinator.handleMessage(this.buildMessage({ body: 'blue', source: { personId: '1234' } }), 'favoriteColor');
79
+ await this.wait(10);
80
+ test_1.assert.isLength(this.sentMessages, 2);
81
+ test_1.assert.isEqual(this.sentMessages[this.sentMessages.length - 1].body, 'blue');
82
+ void this.coordinator.handleMessage(this.buildMessage({ body: 'blue', source: { personId: '1234' } }), 'bookAppointment');
83
+ await this.wait(10);
84
+ test_1.assert.isLength(this.sentMessages, 4);
85
+ test_1.assert.isEqual((_a = this.sentMessages.pop()) === null || _a === void 0 ? void 0 : _a.body, 'Lemme find your appointment!');
86
+ }
87
+ static async canPlaceMixedScriptsUntilTheEndAndStartsOver() {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
+ await this.coordinator.handleMessage(this.buildMessage({ body: '1', source: { personId: '1234' } }), 'mixedStringsAndCallbacks');
90
+ await this.wait(10);
91
+ test_1.assert.isLength(this.sentMessages, 2);
92
+ test_1.assert.isEqual((_a = this.sentMessages[0]) === null || _a === void 0 ? void 0 : _a.body, 'string 1');
93
+ test_1.assert.isEqual((_b = this.sentMessages[1]) === null || _b === void 0 ? void 0 : _b.body, 'prompt 1');
94
+ this.sentMessages = [];
95
+ await this.coordinator.handleMessage(this.buildMessage({ body: 'answer 1', source: { personId: '1234' } }), 'mixedStringsAndCallbacks');
96
+ await this.wait(100);
97
+ test_1.assert.isLength(this.sentMessages, 3);
98
+ test_1.assert.isEqual((_c = this.sentMessages[0]) === null || _c === void 0 ? void 0 : _c.body, 'answer 1');
99
+ test_1.assert.isEqual((_d = this.sentMessages[1]) === null || _d === void 0 ? void 0 : _d.body, 'string 2');
100
+ test_1.assert.isEqual((_e = this.sentMessages[2]) === null || _e === void 0 ? void 0 : _e.body, 'prompt 2');
101
+ this.sentMessages = [];
102
+ await this.coordinator.handleMessage(this.buildMessage({ body: 'answer 2', source: { personId: '1234' } }), 'mixedStringsAndCallbacks');
103
+ test_1.assert.isLength(this.sentMessages, 2);
104
+ test_1.assert.isEqual((_f = this.sentMessages[0]) === null || _f === void 0 ? void 0 : _f.body, 'answer 2');
105
+ test_1.assert.isEqual((_g = this.sentMessages[1]) === null || _g === void 0 ? void 0 : _g.body, 'and done');
106
+ this.sentMessages = [];
107
+ await this.coordinator.handleMessage(this.buildMessage({ body: 'answer 1', source: { personId: '1234' } }), 'mixedStringsAndCallbacks');
108
+ await this.wait(100);
109
+ test_1.assert.isLength(this.sentMessages, 2);
110
+ test_1.assert.isEqual((_h = this.sentMessages[0]) === null || _h === void 0 ? void 0 : _h.body, 'string 1');
111
+ test_1.assert.isEqual((_j = this.sentMessages[1]) === null || _j === void 0 ? void 0 : _j.body, 'prompt 1');
112
+ }
113
+ }
114
+ TopicCoordinatorTest.sentMessages = [];
115
+ __decorate([
116
+ (0, test_1.test)()
117
+ ], TopicCoordinatorTest, "canCreateTopicCoordinator", null);
118
+ __decorate([
119
+ (0, test_1.test)()
120
+ ], TopicCoordinatorTest, "hasHandleMessage", null);
121
+ __decorate([
122
+ (0, test_1.test)()
123
+ ], TopicCoordinatorTest, "handledMessageMustHaveASource", null);
124
+ __decorate([
125
+ (0, test_1.test)()
126
+ ], TopicCoordinatorTest, "respondsWithSuggestedTopicsToFirstMessage", null);
127
+ __decorate([
128
+ (0, test_1.test)()
129
+ ], TopicCoordinatorTest, "handlesNoSkillWithTopics", null);
130
+ __decorate([
131
+ (0, test_1.test)()
132
+ ], TopicCoordinatorTest, "throwsWhenSentBadTopic", null);
133
+ __decorate([
134
+ (0, test_1.test)()
135
+ ], TopicCoordinatorTest, "playsScriptWhenTopicIsSelected", null);
136
+ __decorate([
137
+ (0, test_1.test)()
138
+ ], TopicCoordinatorTest, "canHandlePromptsInScript", null);
139
+ __decorate([
140
+ (0, test_1.test)()
141
+ ], TopicCoordinatorTest, "canPlaceMixedScriptsUntilTheEndAndStartsOver", null);
142
+ exports.default = TopicCoordinatorTest;
@@ -0,0 +1,7 @@
1
+ import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest';
2
+ export default class TextFieldTest extends AbstractGraphicsInterfaceTest {
3
+ protected static promptSendsLabel(): Promise<void>;
4
+ protected static noPromptSendsNoMessage(): Promise<void>;
5
+ protected static respondingWithBadEmailGivesYouAnotherChance(): Promise<void>;
6
+ protected static respondingWithBadEmail2TimesErrors(): Promise<void>;
7
+ }