@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,29 +9,29 @@ 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 AbstractGraphicsInterfaceTest_1 = __importDefault(require("../../../tests/AbstractGraphicsInterfaceTest"));
14
14
  class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest_1.default {
15
15
  static async respondingWithNumberSelectsOptions() {
16
16
  const promise = this.renderAppointmentSelect();
17
17
  await this.sendMessage('1');
18
18
  const results = await promise;
19
- test_1.assert.isEqual(results, 'bookAppointment');
19
+ test_utils_1.assert.isEqual(results, 'bookAppointment');
20
20
  }
21
21
  static async respondingWithBadNumberAsksYouToSelectAgain() {
22
22
  void this.renderAppointmentSelect();
23
23
  await this.sendMessage('5');
24
24
  await this.sendMessage('5');
25
- test_1.assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair' });
26
- test_1.assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair2' });
25
+ test_utils_1.assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair' });
26
+ test_utils_1.assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair2' });
27
27
  const last = this.sentMessages.pop();
28
- test_1.assert.isTruthy(last === null || last === void 0 ? void 0 : last.choices);
28
+ test_utils_1.assert.isTruthy(last === null || last === void 0 ? void 0 : last.choices);
29
29
  }
30
30
  static async respondingWithCloseMatchSelectsChoice() {
31
31
  const promise = this.renderAppointmentSelect();
32
32
  await this.sendMessage('book please');
33
33
  const selection = await promise;
34
- test_1.assert.isEqual(selection, 'bookAppointment');
34
+ test_utils_1.assert.isEqual(selection, 'bookAppointment');
35
35
  }
36
36
  static renderAppointmentSelect() {
37
37
  const choices = [
@@ -52,7 +52,7 @@ class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest_1.defau
52
52
  choices,
53
53
  },
54
54
  });
55
- test_1.assert.doesInclude(this.sentMessages, {
55
+ test_utils_1.assert.doesInclude(this.sentMessages, {
56
56
  body: 'What would you like to do?',
57
57
  choices,
58
58
  });
@@ -60,12 +60,12 @@ class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest_1.defau
60
60
  }
61
61
  }
62
62
  __decorate([
63
- (0, test_1.test)()
63
+ (0, test_utils_1.test)()
64
64
  ], MessageGraphicsInterfaceTest, "respondingWithNumberSelectsOptions", null);
65
65
  __decorate([
66
- (0, test_1.test)()
66
+ (0, test_utils_1.test)()
67
67
  ], MessageGraphicsInterfaceTest, "respondingWithBadNumberAsksYouToSelectAgain", null);
68
68
  __decorate([
69
- (0, test_1.test)()
69
+ (0, test_utils_1.test)()
70
70
  ], MessageGraphicsInterfaceTest, "respondingWithCloseMatchSelectsChoice", null);
71
71
  exports.default = MessageGraphicsInterfaceTest;
@@ -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 AbstractGraphicsInterfaceTest_1 = __importDefault(require("../../../tests/AbstractGraphicsInterfaceTest"));
14
14
  class TextFieldTest extends AbstractGraphicsInterfaceTest_1.default {
15
15
  static async promptSendsLabel() {
@@ -17,13 +17,13 @@ class TextFieldTest extends AbstractGraphicsInterfaceTest_1.default {
17
17
  type: 'text',
18
18
  label: 'Tell me about your life.',
19
19
  });
20
- test_1.assert.doesInclude(this.sentMessages, { body: 'Tell me about your life.' });
20
+ test_utils_1.assert.doesInclude(this.sentMessages, { body: 'Tell me about your life.' });
21
21
  }
22
22
  static async noPromptSendsNoMessage() {
23
23
  void this.ui.prompt({
24
24
  type: 'text',
25
25
  });
26
- test_1.assert.isLength(this.sentMessages, 0);
26
+ test_utils_1.assert.isLength(this.sentMessages, 0);
27
27
  }
28
28
  static async canRespondToPrompt() {
29
29
  const promise = this.ui.prompt({
@@ -31,16 +31,16 @@ class TextFieldTest extends AbstractGraphicsInterfaceTest_1.default {
31
31
  });
32
32
  await this.sendMessage('hey there!');
33
33
  const answer = await promise;
34
- test_1.assert.isEqual(answer, 'hey there!');
34
+ test_utils_1.assert.isEqual(answer, 'hey there!');
35
35
  }
36
36
  }
37
37
  __decorate([
38
- (0, test_1.test)()
38
+ (0, test_utils_1.test)()
39
39
  ], TextFieldTest, "promptSendsLabel", null);
40
40
  __decorate([
41
- (0, test_1.test)()
41
+ (0, test_utils_1.test)()
42
42
  ], TextFieldTest, "noPromptSendsNoMessage", null);
43
43
  __decorate([
44
- (0, test_1.test)()
44
+ (0, test_utils_1.test)()
45
45
  ], TextFieldTest, "canRespondToPrompt", null);
46
46
  exports.default = TextFieldTest;
@@ -32,15 +32,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- const test_1 = require("@sprucelabs/test");
36
35
  const test_utils_1 = require("@sprucelabs/test-utils");
36
+ const test_utils_2 = require("@sprucelabs/test-utils");
37
37
  const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
38
38
  const ScriptTester_1 = __importStar(require("../../tests/ScriptTester"));
39
39
  class ScriptTesterTest extends AbstractConversationTest_1.default {
40
40
  static async throwsWithoutScript() {
41
41
  //@ts-ignore
42
- const err = await test_1.assert.doesThrowAsync(() => ScriptTester_1.default.Tester());
43
- test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
42
+ const err = await test_utils_1.assert.doesThrowAsync(() => ScriptTester_1.default.Tester());
43
+ test_utils_2.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
44
44
  parameters: ['script'],
45
45
  });
46
46
  }
@@ -55,7 +55,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
55
55
  },
56
56
  ],
57
57
  });
58
- test_1.assert.isTruthy(tester);
58
+ test_utils_1.assert.isTruthy(tester);
59
59
  }
60
60
  static async callingGoDoesntCrash() {
61
61
  const tester = await ScriptTester_1.default.Tester({
@@ -87,8 +87,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
87
87
  selectPromptHandler: async () => '',
88
88
  promptHandler: async () => '',
89
89
  });
90
- const err = await test_1.assert.doesThrowAsync(() => tester.handleInput('taco'));
91
- test_utils_1.errorAssert.assertError(err, 'TESTER_NOT_STARTED');
90
+ const err = await test_utils_1.assert.doesThrowAsync(() => tester.handleInput('taco'));
91
+ test_utils_2.errorAssert.assertError(err, 'TESTER_NOT_STARTED');
92
92
  }
93
93
  static async selectingBadScriptToStartThrows() {
94
94
  const tester = await ScriptTester_1.default.Tester({
@@ -99,8 +99,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
99
99
  writeHandler: () => { },
100
100
  promptHandler: async () => '',
101
101
  });
102
- const err = await test_1.assert.doesThrowAsync(() => tester.go());
103
- test_utils_1.errorAssert.assertError(err, 'TOPIC_NOT_FOUND', {
102
+ const err = await test_utils_1.assert.doesThrowAsync(() => tester.go());
103
+ test_utils_2.errorAssert.assertError(err, 'TOPIC_NOT_FOUND', {
104
104
  suppliedTopic: 'oeuou',
105
105
  validTopics: ['bookAppointment', 'cancelAppointment'],
106
106
  });
@@ -121,7 +121,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
121
121
  promptHandler: async () => await new Promise(() => { }),
122
122
  });
123
123
  void tester.go('go team');
124
- test_1.assert.isEqualDeep(choices, [
124
+ test_utils_1.assert.isEqualDeep(choices, [
125
125
  {
126
126
  value: 'bookAppointment',
127
127
  label: 'Book appointment',
@@ -132,7 +132,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
132
132
  },
133
133
  ]);
134
134
  await this.wait(10);
135
- test_1.assert.doesInclude(writes, 'Lets cancel');
135
+ test_utils_1.assert.doesInclude(writes, 'Lets cancel');
136
136
  }
137
137
  static async playsSimpleScript(script) {
138
138
  const writes = [];
@@ -146,7 +146,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
146
146
  selectPromptHandler: async () => '',
147
147
  promptHandler: async () => '',
148
148
  });
149
- test_1.assert.isLength(writes, 0);
149
+ test_utils_1.assert.isLength(writes, 0);
150
150
  void tester.go('hey there!');
151
151
  await this.wait(10);
152
152
  const expected = [
@@ -154,8 +154,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
154
154
  (0, ScriptTester_1.generateTransitionMessage)('discovery'),
155
155
  ScriptTester_1.END_OF_LINE,
156
156
  ];
157
- test_1.assert.isLength(writes, expected.length);
158
- test_1.assert.isEqualDeep(writes, expected);
157
+ test_utils_1.assert.isLength(writes, expected.length);
158
+ test_utils_1.assert.isEqualDeep(writes, expected);
159
159
  }
160
160
  static async canSendInputToThePlayer(answer) {
161
161
  const writes = [];
@@ -195,7 +195,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
195
195
  (0, ScriptTester_1.generateTransitionMessage)('discovery'),
196
196
  ScriptTester_1.END_OF_LINE,
197
197
  ];
198
- test_1.assert.isEqualDeep(writes, expected);
198
+ test_utils_1.assert.isEqualDeep(writes, expected);
199
199
  }
200
200
  static async promptsForFirstMessageIfNoneSentToGo() {
201
201
  const writes = [];
@@ -223,8 +223,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
223
223
  });
224
224
  void tester.go();
225
225
  await this.wait(10);
226
- test_1.assert.isLength(promptWrites, 1);
227
- test_1.assert.isLength(writes, 0);
226
+ test_utils_1.assert.isLength(promptWrites, 1);
227
+ test_utils_1.assert.isLength(writes, 0);
228
228
  promptResolve();
229
229
  await this.wait(10);
230
230
  const expected = [
@@ -233,7 +233,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
233
233
  (0, ScriptTester_1.generateTransitionMessage)('discovery'),
234
234
  ScriptTester_1.END_OF_LINE,
235
235
  ];
236
- test_1.assert.isEqualDeep(writes, expected);
236
+ test_utils_1.assert.isEqualDeep(writes, expected);
237
237
  }
238
238
  static async showsConfidenceRatingBasedOnFirstMesageSent() {
239
239
  const writes = [];
@@ -259,7 +259,7 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
259
259
  });
260
260
  void tester.go('team');
261
261
  await this.wait(10);
262
- test_1.assert.doesInclude(writes, `%`);
262
+ test_utils_1.assert.doesInclude(writes, `%`);
263
263
  }
264
264
  static async promptsToStartAgainAfterDone() {
265
265
  const writes = [];
@@ -288,8 +288,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
288
288
  });
289
289
  void tester.go();
290
290
  await this.wait(500);
291
- test_1.assert.isEqual(promptHitCount, 3);
292
- test_1.assert.isEqualDeep(writes, [
291
+ test_utils_1.assert.isEqual(promptHitCount, 3);
292
+ test_utils_1.assert.isEqualDeep(writes, [
293
293
  'go',
294
294
  'team',
295
295
  (0, ScriptTester_1.generateTransitionMessage)('discovery'),
@@ -336,8 +336,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
336
336
  });
337
337
  void tester.go();
338
338
  await this.wait(500);
339
- test_1.assert.isEqual(promptHitCount, 3);
340
- test_1.assert.isEqualDeep(writes, [
339
+ test_utils_1.assert.isEqual(promptHitCount, 3);
340
+ test_utils_1.assert.isEqualDeep(writes, [
341
341
  'my',
342
342
  'team',
343
343
  'topic_changer',
@@ -386,8 +386,8 @@ class ScriptTesterTest extends AbstractConversationTest_1.default {
386
386
  });
387
387
  void tester.go();
388
388
  await this.wait(500);
389
- test_1.assert.isEqual(promptHitCount, 3);
390
- test_1.assert.isEqualDeep(writes, [
389
+ test_utils_1.assert.isEqual(promptHitCount, 3);
390
+ test_utils_1.assert.isEqualDeep(writes, [
391
391
  'my',
392
392
  'team',
393
393
  'repairs',
@@ -416,44 +416,44 @@ ScriptTesterTest.basicBookingScript = [
416
416
  },
417
417
  ];
418
418
  __decorate([
419
- (0, test_1.test)()
419
+ (0, test_utils_1.test)()
420
420
  ], ScriptTesterTest, "throwsWithoutScript", null);
421
421
  __decorate([
422
- (0, test_1.test)()
422
+ (0, test_utils_1.test)()
423
423
  ], ScriptTesterTest, "acceptsSimpleScript", null);
424
424
  __decorate([
425
- (0, test_1.test)()
425
+ (0, test_utils_1.test)()
426
426
  ], ScriptTesterTest, "callingGoDoesntCrash", null);
427
427
  __decorate([
428
- (0, test_1.test)()
428
+ (0, test_utils_1.test)()
429
429
  ], ScriptTesterTest, "cantHandleMessageBeforeStartup", null);
430
430
  __decorate([
431
- (0, test_1.test)()
431
+ (0, test_utils_1.test)()
432
432
  ], ScriptTesterTest, "selectingBadScriptToStartThrows", null);
433
433
  __decorate([
434
- (0, test_1.test)()
434
+ (0, test_utils_1.test)()
435
435
  ], ScriptTesterTest, "asksWhichScriptYouWantToStartWithWhenThereIsMoreThanOne", null);
436
436
  __decorate([
437
- (0, test_1.test)('plays single line script', ['hey there']),
438
- (0, test_1.test)('plays multi line script', ['hey there', 'how are you?'])
437
+ (0, test_utils_1.test)('plays single line script', ['hey there']),
438
+ (0, test_utils_1.test)('plays multi line script', ['hey there', 'how are you?'])
439
439
  ], ScriptTesterTest, "playsSimpleScript", null);
440
440
  __decorate([
441
- (0, test_1.test)('passes the confirm', 'yes'),
442
- (0, test_1.test)('fails the confirm', 'no')
441
+ (0, test_utils_1.test)('passes the confirm', 'yes'),
442
+ (0, test_utils_1.test)('fails the confirm', 'no')
443
443
  ], ScriptTesterTest, "canSendInputToThePlayer", null);
444
444
  __decorate([
445
- (0, test_1.test)()
445
+ (0, test_utils_1.test)()
446
446
  ], ScriptTesterTest, "promptsForFirstMessageIfNoneSentToGo", null);
447
447
  __decorate([
448
- (0, test_1.test)()
448
+ (0, test_utils_1.test)()
449
449
  ], ScriptTesterTest, "showsConfidenceRatingBasedOnFirstMesageSent", null);
450
450
  __decorate([
451
- (0, test_1.test)()
451
+ (0, test_utils_1.test)()
452
452
  ], ScriptTesterTest, "promptsToStartAgainAfterDone", null);
453
453
  __decorate([
454
- (0, test_1.test)()
454
+ (0, test_utils_1.test)()
455
455
  ], ScriptTesterTest, "messagesAboutTransitionResponseTopicChanger", null);
456
456
  __decorate([
457
- (0, test_1.test)()
457
+ (0, test_utils_1.test)()
458
458
  ], ScriptTesterTest, "messagesAboutTransitionResponseWithRepairs", null);
459
459
  exports.default = ScriptTesterTest;
@@ -9,17 +9,17 @@ 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
  const suggester_utility_1 = __importDefault(require("../../utilities/suggester.utility"));
15
15
  class SuggesterUtilTest extends AbstractConversationTest_1.default {
16
16
  static async suggesterExists() {
17
- test_1.assert.isTruthy(suggester_utility_1.default);
17
+ test_utils_1.assert.isTruthy(suggester_utility_1.default);
18
18
  }
19
19
  static async returnsOnlyPossibility() {
20
20
  const results = await suggester_utility_1.default.rank([{ key: 'test', phrase: 'test' }], 'test');
21
- test_1.assert.isArray(results);
22
- test_1.assert.isEqualDeep(results, [
21
+ test_utils_1.assert.isArray(results);
22
+ test_utils_1.assert.isEqualDeep(results, [
23
23
  {
24
24
  key: 'test',
25
25
  score: 1,
@@ -31,33 +31,33 @@ class SuggesterUtilTest extends AbstractConversationTest_1.default {
31
31
  { key: 'wronge', phrase: 'wronge' },
32
32
  { key: 'test', phrase: 'test' },
33
33
  ], 'test');
34
- test_1.assert.isArray(results);
35
- test_1.assert.isEqualDeep(results[0], {
34
+ test_utils_1.assert.isArray(results);
35
+ test_utils_1.assert.isEqualDeep(results[0], {
36
36
  key: 'test',
37
37
  score: 1,
38
38
  });
39
39
  }
40
40
  static async matchesByReturningTopOptionsAboveThreshold(phrases, utterance, expected) {
41
41
  const results = await suggester_utility_1.default.doesMatch(phrases, utterance);
42
- test_1.assert.isEqual(results, expected);
42
+ test_utils_1.assert.isEqual(results, expected);
43
43
  }
44
44
  }
45
45
  __decorate([
46
- (0, test_1.test)()
46
+ (0, test_utils_1.test)()
47
47
  ], SuggesterUtilTest, "suggesterExists", null);
48
48
  __decorate([
49
- (0, test_1.test)()
49
+ (0, test_utils_1.test)()
50
50
  ], SuggesterUtilTest, "returnsOnlyPossibility", null);
51
51
  __decorate([
52
- (0, test_1.test)()
52
+ (0, test_utils_1.test)()
53
53
  ], SuggesterUtilTest, "returnsSortedByBestGuess", null);
54
54
  __decorate([
55
- (0, test_1.test)('doesMatch is false when way off', ['one', 'two', 'three', 'four'], 'miss', false),
56
- (0, test_1.test)('doesMatch is true when perfect match', ['one', 'two', 'three', 'four'], 'one', true),
57
- (0, test_1.test)('doesMatch is true with ha', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah', 'haha'], 'haha!!!', true),
58
- (0, test_1.test)('doesMatch is true with ha', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'lol', true),
59
- (0, test_1.test)('doesMatch is false with lame', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'lame', false),
60
- (0, test_1.test)('doesMatch is false with horrible', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'horrible', false),
61
- (0, test_1.test)('doesMatch is false with hey', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'hey', false)
55
+ (0, test_utils_1.test)('doesMatch is false when way off', ['one', 'two', 'three', 'four'], 'miss', false),
56
+ (0, test_utils_1.test)('doesMatch is true when perfect match', ['one', 'two', 'three', 'four'], 'one', true),
57
+ (0, test_utils_1.test)('doesMatch is true with ha', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah', 'haha'], 'haha!!!', true),
58
+ (0, test_utils_1.test)('doesMatch is true with ha', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'lol', true),
59
+ (0, test_utils_1.test)('doesMatch is false with lame', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'lame', false),
60
+ (0, test_utils_1.test)('doesMatch is false with horrible', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'horrible', false),
61
+ (0, test_utils_1.test)('doesMatch is false with hey', ['ha', 'haha', 'lol', 'lolz', 'rofl', 'hahahah'], 'hey', false)
62
62
  ], SuggesterUtilTest, "matchesByReturningTopOptionsAboveThreshold", null);
63
63
  exports.default = SuggesterUtilTest;
@@ -9,58 +9,58 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const test_1 = require("@sprucelabs/test");
13
12
  const test_utils_1 = require("@sprucelabs/test-utils");
13
+ const test_utils_2 = require("@sprucelabs/test-utils");
14
14
  const AbstractConversationTest_1 = __importDefault(require("../../tests/AbstractConversationTest"));
15
15
  const TopicLoader_1 = __importDefault(require("../../topics/TopicLoader"));
16
16
  class TopicLoaderTest extends AbstractConversationTest_1.default {
17
17
  static async loadsNoTopicsWithBadDir() {
18
18
  const source = this.resolvePath('doesNotExist');
19
19
  const topics = await TopicLoader_1.default.loadTopics(source);
20
- test_1.assert.isLength(topics, 0);
20
+ test_utils_1.assert.isLength(topics, 0);
21
21
  }
22
22
  static async throwsWhenLoadingEmpty() {
23
23
  const source = this.resolveTestPath('bad-empty');
24
- const err = await test_1.assert.doesThrowAsync(() => TopicLoader_1.default.loadTopics(source));
25
- test_utils_1.errorAssert.assertError(err, 'INVALID_TOPIC', {
24
+ const err = await test_utils_1.assert.doesThrowAsync(() => TopicLoader_1.default.loadTopics(source));
25
+ test_utils_2.errorAssert.assertError(err, 'INVALID_TOPIC', {
26
26
  topicScript: 'bookAppointment.topic',
27
27
  });
28
28
  }
29
29
  static async throwsWhenMissingParameters() {
30
30
  const source = this.resolveTestPath('bad-missing-params');
31
- const err = await test_1.assert.doesThrowAsync(() => TopicLoader_1.default.loadTopics(source));
32
- test_utils_1.errorAssert.assertError(err, 'INVALID_TOPIC', {
31
+ const err = await test_utils_1.assert.doesThrowAsync(() => TopicLoader_1.default.loadTopics(source));
32
+ test_utils_2.errorAssert.assertError(err, 'INVALID_TOPIC', {
33
33
  topicScript: 'bookAppointment.topic',
34
34
  });
35
35
  //@ts-ignore
36
36
  const original = err.options.originalError;
37
- test_utils_1.errorAssert.assertError(original, 'MISSING_PARAMETERS', {
37
+ test_utils_2.errorAssert.assertError(original, 'MISSING_PARAMETERS', {
38
38
  parameters: ['label', 'utterances', 'script'],
39
39
  });
40
40
  }
41
41
  static async canLoadTopics() {
42
42
  const scripts = await TopicLoader_1.default.loadTopics(this.resolveTestPath('good'));
43
- test_1.assert.isLength(scripts, 2);
43
+ test_utils_1.assert.isLength(scripts, 2);
44
44
  }
45
45
  static async loadedTopicsSetKey() {
46
46
  const scripts = await TopicLoader_1.default.loadTopics(this.resolveTestPath('good'));
47
- test_1.assert.doesInclude(scripts, { key: 'bookAppointment' });
48
- test_1.assert.doesInclude(scripts, { key: 'cancelAppointment' });
47
+ test_utils_1.assert.doesInclude(scripts, { key: 'bookAppointment' });
48
+ test_utils_1.assert.doesInclude(scripts, { key: 'cancelAppointment' });
49
49
  }
50
50
  }
51
51
  __decorate([
52
- (0, test_1.test)()
52
+ (0, test_utils_1.test)()
53
53
  ], TopicLoaderTest, "loadsNoTopicsWithBadDir", null);
54
54
  __decorate([
55
- (0, test_1.test)()
55
+ (0, test_utils_1.test)()
56
56
  ], TopicLoaderTest, "throwsWhenLoadingEmpty", null);
57
57
  __decorate([
58
- (0, test_1.test)()
58
+ (0, test_utils_1.test)()
59
59
  ], TopicLoaderTest, "throwsWhenMissingParameters", null);
60
60
  __decorate([
61
- (0, test_1.test)()
61
+ (0, test_utils_1.test)()
62
62
  ], TopicLoaderTest, "canLoadTopics", null);
63
63
  __decorate([
64
- (0, test_1.test)()
64
+ (0, test_utils_1.test)()
65
65
  ], TopicLoaderTest, "loadedTopicsSetKey", null);
66
66
  exports.default = TopicLoaderTest;