@sprucelabs/spruce-conversation-plugin 62.2.24 → 62.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/package.json +17 -17
  2. package/build/__tests__/behavioral/CheckingHealth.test.d.ts +0 -10
  3. package/build/__tests__/behavioral/CheckingHealth.test.js +0 -87
  4. package/build/__tests__/behavioral/KillingASkill.test.d.ts +0 -4
  5. package/build/__tests__/behavioral/KillingASkill.test.js +0 -29
  6. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +0 -13
  7. package/build/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +0 -147
  8. package/build/__tests__/behavioral/RespondingToMessages.test.d.ts +0 -13
  9. package/build/__tests__/behavioral/RespondingToMessages.test.js +0 -134
  10. package/build/__tests__/behavioral/TestingAConversation.test.d.ts +0 -14
  11. package/build/__tests__/behavioral/TestingAConversation.test.js +0 -110
  12. package/build/__tests__/implementation/ConversationCoordinator.test.d.ts +0 -18
  13. package/build/__tests__/implementation/ConversationCoordinator.test.js +0 -185
  14. package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +0 -7
  15. package/build/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +0 -73
  16. package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +0 -4
  17. package/build/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +0 -42
  18. package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.d.ts +0 -5
  19. package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.js +0 -62
  20. package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.d.ts +0 -18
  21. package/build/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.js +0 -168
  22. package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +0 -7
  23. package/build/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +0 -71
  24. package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +0 -6
  25. package/build/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +0 -48
  26. package/build/__tests__/implementation/ScriptTester.test.d.ts +0 -19
  27. package/build/__tests__/implementation/ScriptTester.test.js +0 -461
  28. package/build/__tests__/implementation/SuggesterUtil.test.d.ts +0 -7
  29. package/build/__tests__/implementation/SuggesterUtil.test.js +0 -63
  30. package/build/__tests__/implementation/TopicLoader.test.d.ts +0 -8
  31. package/build/__tests__/implementation/TopicLoader.test.js +0 -66
  32. package/build/__tests__/implementation/TopicScriptPlayer.test.d.ts +0 -23
  33. package/build/__tests__/implementation/TopicScriptPlayer.test.js +0 -436
  34. package/build/__tests__/implementation/TopicSuggester.test.d.ts +0 -8
  35. package/build/__tests__/implementation/TopicSuggester.test.js +0 -137
  36. package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
  37. package/build/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +0 -1
  38. package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +0 -2
  39. package/build/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +0 -4
  40. package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.d.ts +0 -2
  41. package/build/__tests__/testDirsAndFiles/bad-skill/build/.spruce/events/listeners.js +0 -3
  42. package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +0 -2
  43. package/build/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +0 -4
  44. package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.d.ts +0 -2
  45. package/build/__tests__/testDirsAndFiles/empty-skill/build/.spruce/events/listeners.js +0 -3
  46. package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +0 -3
  47. package/build/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +0 -8
  48. package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +0 -3
  49. package/build/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +0 -12
  50. package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.d.ts +0 -2
  51. package/build/__tests__/testDirsAndFiles/skill/build/.spruce/events/listeners.js +0 -3
  52. package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +0 -3
  53. package/build/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +0 -8
  54. package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +0 -3
  55. package/build/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +0 -12
  56. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +0 -3
  57. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +0 -21
  58. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +0 -3
  59. package/build/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +0 -21
  60. package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +0 -3
  61. package/build/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +0 -29
  62. package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.d.ts +0 -2
  63. package/build/__tests__/testDirsAndFiles/skill-assertions/build/.spruce/events/listeners.js +0 -3
  64. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +0 -3
  65. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +0 -22
  66. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +0 -3
  67. package/build/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +0 -14
  68. package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/.spruce/events/listeners.d.ts +0 -2
  69. package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/.spruce/events/listeners.js +0 -3
  70. package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.d.ts +0 -3
  71. package/build/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.js +0 -8
  72. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.d.ts +0 -2
  73. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/.spruce/events/listeners.js +0 -3
  74. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +0 -3
  75. package/build/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +0 -16
  76. package/build/esm/__tests__/behavioral/CheckingHealth.test.d.ts +0 -10
  77. package/build/esm/__tests__/behavioral/CheckingHealth.test.js +0 -104
  78. package/build/esm/__tests__/behavioral/KillingASkill.test.d.ts +0 -4
  79. package/build/esm/__tests__/behavioral/KillingASkill.test.js +0 -34
  80. package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.d.ts +0 -13
  81. package/build/esm/__tests__/behavioral/RegisteringConversationsOnBoot.test.js +0 -171
  82. package/build/esm/__tests__/behavioral/RespondingToMessages.test.d.ts +0 -13
  83. package/build/esm/__tests__/behavioral/RespondingToMessages.test.js +0 -158
  84. package/build/esm/__tests__/behavioral/TestingAConversation.test.d.ts +0 -14
  85. package/build/esm/__tests__/behavioral/TestingAConversation.test.js +0 -137
  86. package/build/esm/__tests__/implementation/ConversationCoordinator.test.d.ts +0 -18
  87. package/build/esm/__tests__/implementation/ConversationCoordinator.test.js +0 -214
  88. package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.d.ts +0 -7
  89. package/build/esm/__tests__/implementation/MessageGraphicsInterface/EmailField.test.js +0 -84
  90. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.d.ts +0 -4
  91. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MessageGraphicsInterface.test.js +0 -47
  92. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.d.ts +0 -5
  93. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageBeforeAndAfterEach.test.js +0 -47
  94. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.d.ts +0 -18
  95. package/build/esm/__tests__/implementation/MessageGraphicsInterface/MockMessageInterface.test.js +0 -172
  96. package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.d.ts +0 -7
  97. package/build/esm/__tests__/implementation/MessageGraphicsInterface/SelectField.test.js +0 -80
  98. package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.d.ts +0 -6
  99. package/build/esm/__tests__/implementation/MessageGraphicsInterface/TextField.test.js +0 -57
  100. package/build/esm/__tests__/implementation/ScriptTester.test.d.ts +0 -19
  101. package/build/esm/__tests__/implementation/ScriptTester.test.js +0 -470
  102. package/build/esm/__tests__/implementation/SuggesterUtil.test.d.ts +0 -7
  103. package/build/esm/__tests__/implementation/SuggesterUtil.test.js +0 -74
  104. package/build/esm/__tests__/implementation/TopicLoader.test.d.ts +0 -8
  105. package/build/esm/__tests__/implementation/TopicLoader.test.js +0 -79
  106. package/build/esm/__tests__/implementation/TopicScriptPlayer.test.d.ts +0 -23
  107. package/build/esm/__tests__/implementation/TopicScriptPlayer.test.js +0 -477
  108. package/build/esm/__tests__/implementation/TopicSuggester.test.d.ts +0 -8
  109. package/build/esm/__tests__/implementation/TopicSuggester.test.js +0 -130
  110. package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.d.ts +0 -0
  111. package/build/esm/__tests__/testDirsAndFiles/bad-empty/conversations/bookAppointment.topic.js +0 -1
  112. package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.d.ts +0 -2
  113. package/build/esm/__tests__/testDirsAndFiles/bad-missing-params/conversations/bookAppointment.topic.js +0 -2
  114. package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.d.ts +0 -2
  115. package/build/esm/__tests__/testDirsAndFiles/bad-skill/build/conversations/bookAppointment.topic.js +0 -2
  116. package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.d.ts +0 -3
  117. package/build/esm/__tests__/testDirsAndFiles/good/conversations/bookAppointment.topic.js +0 -6
  118. package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.d.ts +0 -3
  119. package/build/esm/__tests__/testDirsAndFiles/good/conversations/cancelAppointment.topic.js +0 -10
  120. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.d.ts +0 -3
  121. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/bookAppointment.topic.js +0 -6
  122. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.d.ts +0 -3
  123. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/cancelAppointment.topic.js +0 -10
  124. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.d.ts +0 -3
  125. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColor.topic.js +0 -28
  126. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.d.ts +0 -3
  127. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/favoriteColorTopicChanger.topic.js +0 -28
  128. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.d.ts +0 -3
  129. package/build/esm/__tests__/testDirsAndFiles/skill/build/conversations/mixedStringsAndCallbacks.topic.js +0 -36
  130. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.d.ts +0 -3
  131. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptCallbackOptions.topic.js +0 -29
  132. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.d.ts +0 -3
  133. package/build/esm/__tests__/testDirsAndFiles/skill-assertions/build/conversations/assertsScriptOnlyCalledOnce.topic.js +0 -21
  134. package/build/esm/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.d.ts +0 -3
  135. package/build/esm/__tests__/testDirsAndFiles/skill-with-one-topic/build/conversations/bookAppointment.topic.js +0 -6
  136. package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.d.ts +0 -3
  137. package/build/esm/__tests__/testDirsAndFiles/skill-with-script-that-throws/build/conversations/cancelAppointment.topic.js +0 -14
@@ -1,47 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import { test, assert } from '@sprucelabs/test-utils';
17
- import { errorAssert } from '@sprucelabs/test-utils';
18
- import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
19
- export default class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest {
20
- static selectAsksAgainWithBadResponse() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const promise = this.ui.prompt({
23
- type: 'select',
24
- label: 'What would you like to do?',
25
- isRequired: true,
26
- options: {
27
- choices: [
28
- {
29
- label: 'Book appointment',
30
- value: 'bookAppointment',
31
- },
32
- {
33
- label: 'Cancel appointment',
34
- value: 'cancelAppointment',
35
- },
36
- ],
37
- },
38
- });
39
- yield this.sendMessage('get me out of here!');
40
- const err = yield assert.doesThrowAsync(() => __awaiter(this, void 0, void 0, function* () { return yield promise; }));
41
- errorAssert.assertError(err, 'ABORT');
42
- });
43
- }
44
- }
45
- __decorate([
46
- test()
47
- ], MessageGraphicsInterfaceTest, "selectAsksAgainWithBadResponse", null);
@@ -1,5 +0,0 @@
1
- import AbstractSpruceTest from '@sprucelabs/test-utils';
2
- export default class SpyMessageBeforeAndAfterEachTest extends AbstractSpruceTest {
3
- protected static throwsIfInstantiatingTwoWithoutCallingAfterEach(): Promise<void>;
4
- protected static throwsIfDanglingPrompt(): Promise<void>;
5
- }
@@ -1,47 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import { fake } from '@sprucelabs/spruce-test-fixtures';
17
- import AbstractSpruceTest, { test, assert } from '@sprucelabs/test-utils';
18
- import MockMessageInterface from '../../../interfaces/MockMessageInterface.js';
19
- let SpyMessageBeforeAndAfterEachTest = class SpyMessageBeforeAndAfterEachTest extends AbstractSpruceTest {
20
- static throwsIfInstantiatingTwoWithoutCallingAfterEach() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- MockMessageInterface.Ui();
23
- assert.doesThrow(() => MockMessageInterface.Ui());
24
- MockMessageInterface.afterEach();
25
- MockMessageInterface.Ui();
26
- });
27
- }
28
- static throwsIfDanglingPrompt() {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- MockMessageInterface.afterEach();
31
- const ui = MockMessageInterface.Ui();
32
- void ui.prompt({ type: 'number' });
33
- ui.renderLine('Hey there!');
34
- assert.doesThrow(() => MockMessageInterface.afterEach());
35
- });
36
- }
37
- };
38
- __decorate([
39
- test()
40
- ], SpyMessageBeforeAndAfterEachTest, "throwsIfInstantiatingTwoWithoutCallingAfterEach", null);
41
- __decorate([
42
- test()
43
- ], SpyMessageBeforeAndAfterEachTest, "throwsIfDanglingPrompt", null);
44
- SpyMessageBeforeAndAfterEachTest = __decorate([
45
- fake.login()
46
- ], SpyMessageBeforeAndAfterEachTest);
47
- export default SpyMessageBeforeAndAfterEachTest;
@@ -1,18 +0,0 @@
1
- import AbstractSpruceTest from '@sprucelabs/test-utils';
2
- export default class SpyMessageInterfaceTest extends AbstractSpruceTest {
3
- private static ui;
4
- protected static beforeEach(): Promise<void>;
5
- protected static afterEach(): Promise<void>;
6
- protected static knowsIfDidntPromp(): Promise<void>;
7
- protected static holdsUntilPromptIsAnswered(): Promise<void>;
8
- protected static tracksPrompts(): Promise<void>;
9
- protected static throwsIfRenderedAfterPrompt(): Promise<void>;
10
- protected static canAssertSelectChoices(): Promise<void>;
11
- protected static canAssertDifferentSelectChoices(): Promise<void>;
12
- protected static canAssertIfRequired(): Promise<void>;
13
- private static assertPromptedWithChoices;
14
- private static promptWithChoices;
15
- private static resetUi;
16
- private static prompt;
17
- private static assertNotJustPromptedFor;
18
- }
@@ -1,172 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import AbstractSpruceTest, { test, assert, generateId, } from '@sprucelabs/test-utils';
17
- import MockMessageInterface from '../../../interfaces/MockMessageInterface.js';
18
- export default class SpyMessageInterfaceTest extends AbstractSpruceTest {
19
- static beforeEach() {
20
- const _super = Object.create(null, {
21
- beforeEach: { get: () => super.beforeEach }
22
- });
23
- return __awaiter(this, void 0, void 0, function* () {
24
- yield _super.beforeEach.call(this);
25
- this.ui = MockMessageInterface.Ui();
26
- });
27
- }
28
- static afterEach() {
29
- const _super = Object.create(null, {
30
- afterEach: { get: () => super.afterEach }
31
- });
32
- return __awaiter(this, void 0, void 0, function* () {
33
- yield _super.afterEach.call(this);
34
- MockMessageInterface.afterEach();
35
- });
36
- }
37
- static knowsIfDidntPromp() {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- this.assertNotJustPromptedFor('number');
40
- });
41
- }
42
- static holdsUntilPromptIsAnswered() {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- const promise = this.prompt({ type: 'text' });
45
- const expected = generateId();
46
- this.ui.answerPrompt(expected);
47
- const answer = yield promise;
48
- assert.isEqual(answer, expected);
49
- });
50
- }
51
- static tracksPrompts() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- void this.prompt({
54
- type: 'number',
55
- isRequired: true,
56
- });
57
- this.ui.assertJustPromptedFor('number');
58
- this.assertNotJustPromptedFor('text');
59
- this.resetUi();
60
- });
61
- }
62
- static throwsIfRenderedAfterPrompt() {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- void this.prompt({
65
- type: 'number',
66
- isRequired: true,
67
- });
68
- this.ui.renderLine('go dogs go!');
69
- this.assertNotJustPromptedFor('number');
70
- this.resetUi();
71
- });
72
- }
73
- static canAssertSelectChoices() {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- this.promptWithChoices([
76
- {
77
- label: 'Hey',
78
- value: 'hello',
79
- },
80
- ]);
81
- assert.doesThrow(() => this.assertPromptedWithChoices([
82
- {
83
- value: 'what the!?',
84
- },
85
- ]));
86
- this.assertPromptedWithChoices([
87
- {
88
- value: 'hello',
89
- },
90
- ]);
91
- this.resetUi();
92
- });
93
- }
94
- static canAssertDifferentSelectChoices() {
95
- return __awaiter(this, void 0, void 0, function* () {
96
- const value = generateId();
97
- this.promptWithChoices([
98
- {
99
- value,
100
- label: 'What theee!!!!??',
101
- },
102
- { value: 'hello', label: 'Hello!' },
103
- ]);
104
- this.assertPromptedWithChoices([
105
- {
106
- value,
107
- },
108
- {
109
- value: 'hello',
110
- },
111
- ]);
112
- this.resetUi();
113
- });
114
- }
115
- static canAssertIfRequired() {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- void this.prompt({
118
- type: 'number',
119
- options: {
120
- min: 0,
121
- max: 100,
122
- },
123
- });
124
- assert.doesThrow(() => this.ui.assertJustPromptedFor('number', { min: 10, max: 20 }));
125
- this.ui.assertJustPromptedFor('number', { min: 0, max: 100 });
126
- this.resetUi();
127
- });
128
- }
129
- static assertPromptedWithChoices(expected) {
130
- return this.ui.assertJustPromptedFor('select', {
131
- choices: expected,
132
- });
133
- }
134
- static promptWithChoices(choices) {
135
- void this.prompt({
136
- type: 'select',
137
- options: {
138
- choices,
139
- },
140
- });
141
- }
142
- static resetUi() {
143
- this.ui.reset();
144
- }
145
- static prompt(definition) {
146
- return this.ui.prompt(definition);
147
- }
148
- static assertNotJustPromptedFor(type) {
149
- assert.doesThrow(() => this.ui.assertJustPromptedFor(type));
150
- }
151
- }
152
- __decorate([
153
- test()
154
- ], SpyMessageInterfaceTest, "knowsIfDidntPromp", null);
155
- __decorate([
156
- test()
157
- ], SpyMessageInterfaceTest, "holdsUntilPromptIsAnswered", null);
158
- __decorate([
159
- test()
160
- ], SpyMessageInterfaceTest, "tracksPrompts", null);
161
- __decorate([
162
- test()
163
- ], SpyMessageInterfaceTest, "throwsIfRenderedAfterPrompt", null);
164
- __decorate([
165
- test()
166
- ], SpyMessageInterfaceTest, "canAssertSelectChoices", null);
167
- __decorate([
168
- test()
169
- ], SpyMessageInterfaceTest, "canAssertDifferentSelectChoices", null);
170
- __decorate([
171
- test()
172
- ], SpyMessageInterfaceTest, "canAssertIfRequired", null);
@@ -1,7 +0,0 @@
1
- import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest';
2
- export default class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest {
3
- protected static respondingWithNumberSelectsOptions(): Promise<void>;
4
- protected static respondingWithBadNumberAsksYouToSelectAgain(): Promise<void>;
5
- protected static respondingWithCloseMatchSelectsChoice(): Promise<void>;
6
- private static renderAppointmentSelect;
7
- }
@@ -1,80 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import { test, assert } from '@sprucelabs/test-utils';
17
- import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
18
- export default class MessageGraphicsInterfaceTest extends AbstractGraphicsInterfaceTest {
19
- static respondingWithNumberSelectsOptions() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const promise = this.renderAppointmentSelect();
22
- yield this.sendMessage('1');
23
- const results = yield promise;
24
- assert.isEqual(results, 'bookAppointment');
25
- });
26
- }
27
- static respondingWithBadNumberAsksYouToSelectAgain() {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- void this.renderAppointmentSelect();
30
- yield this.sendMessage('5');
31
- yield this.sendMessage('5');
32
- assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair' });
33
- assert.doesInclude(this.sentMessages, { body: 'invalid-value-repair2' });
34
- const last = this.sentMessages.pop();
35
- assert.isTruthy(last === null || last === void 0 ? void 0 : last.choices);
36
- });
37
- }
38
- static respondingWithCloseMatchSelectsChoice() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const promise = this.renderAppointmentSelect();
41
- yield this.sendMessage('book please');
42
- const selection = yield promise;
43
- assert.isEqual(selection, 'bookAppointment');
44
- });
45
- }
46
- static renderAppointmentSelect() {
47
- const choices = [
48
- {
49
- label: 'Book appointment',
50
- value: 'bookAppointment',
51
- },
52
- {
53
- label: 'Cancel appointment',
54
- value: 'cancelAppointment',
55
- },
56
- ];
57
- const response = this.ui.prompt({
58
- type: 'select',
59
- label: 'What would you like to do?',
60
- isRequired: true,
61
- options: {
62
- choices,
63
- },
64
- });
65
- assert.doesInclude(this.sentMessages, {
66
- body: 'What would you like to do?',
67
- choices,
68
- });
69
- return response;
70
- }
71
- }
72
- __decorate([
73
- test()
74
- ], MessageGraphicsInterfaceTest, "respondingWithNumberSelectsOptions", null);
75
- __decorate([
76
- test()
77
- ], MessageGraphicsInterfaceTest, "respondingWithBadNumberAsksYouToSelectAgain", null);
78
- __decorate([
79
- test()
80
- ], MessageGraphicsInterfaceTest, "respondingWithCloseMatchSelectsChoice", null);
@@ -1,6 +0,0 @@
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 canRespondToPrompt(): Promise<void>;
6
- }
@@ -1,57 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import { test, assert } from '@sprucelabs/test-utils';
17
- import AbstractGraphicsInterfaceTest from '../../../tests/AbstractGraphicsInterfaceTest.js';
18
- export default class TextFieldTest extends AbstractGraphicsInterfaceTest {
19
- static promptSendsLabel() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- void this.ui.prompt({
22
- type: 'text',
23
- label: 'Tell me about your life.',
24
- });
25
- assert.doesInclude(this.sentMessages, {
26
- body: 'Tell me about your life.',
27
- });
28
- });
29
- }
30
- static noPromptSendsNoMessage() {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- void this.ui.prompt({
33
- type: 'text',
34
- });
35
- assert.isLength(this.sentMessages, 0);
36
- });
37
- }
38
- static canRespondToPrompt() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const promise = this.ui.prompt({
41
- type: 'text',
42
- });
43
- yield this.sendMessage('hey there!');
44
- const answer = yield promise;
45
- assert.isEqual(answer, 'hey there!');
46
- });
47
- }
48
- }
49
- __decorate([
50
- test()
51
- ], TextFieldTest, "promptSendsLabel", null);
52
- __decorate([
53
- test()
54
- ], TextFieldTest, "noPromptSendsNoMessage", null);
55
- __decorate([
56
- test()
57
- ], TextFieldTest, "canRespondToPrompt", null);
@@ -1,19 +0,0 @@
1
- import AbstractConversationTest from '../../tests/AbstractConversationTest';
2
- import { Script } from '../../types/conversation.types';
3
- export default class ScriptTesterTest extends AbstractConversationTest {
4
- private static readonly basicBookingScript;
5
- protected static throwsWithoutScript(): Promise<void>;
6
- protected static acceptsSimpleScript(): Promise<void>;
7
- protected static callingGoDoesntCrash(): Promise<void>;
8
- protected static cantHandleMessageBeforeStartup(): Promise<void>;
9
- protected static selectingBadScriptToStartThrows(): Promise<void>;
10
- protected static asksWhichScriptYouWantToStartWithWhenThereIsMoreThanOne(): Promise<void>;
11
- protected static playsSimpleScript(script: Script): Promise<void>;
12
- protected static canSendInputToThePlayer(answer: string): Promise<void>;
13
- protected static promptsForFirstMessageIfNoneSentToGo(): Promise<void>;
14
- protected static showsConfidenceRatingBasedOnFirstMesageSent(): Promise<void>;
15
- protected static promptsToStartAgainAfterDone(): Promise<void>;
16
- protected static messagesAboutTransitionResponseTopicChanger(): Promise<void>;
17
- protected static messagesAboutTransitionResponseWithRepairs(): Promise<void>;
18
- private static Tester;
19
- }