@sprucelabs/spruce-conversation-plugin 49.0.39 → 49.0.42

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