@sprucelabs/mercury-client 42.0.557 → 42.0.558

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 (174) hide show
  1. package/build/esm/.spruce/errors/errors.types.d.ts +324 -0
  2. package/build/esm/.spruce/errors/errors.types.js +1 -0
  3. package/build/esm/.spruce/errors/mercuryClient/connectionFailed.schema.d.ts +3 -0
  4. package/build/esm/.spruce/errors/mercuryClient/connectionFailed.schema.js +25 -0
  5. package/build/esm/.spruce/errors/mercuryClient/invalidEventSignature.schema.d.ts +3 -0
  6. package/build/esm/.spruce/errors/mercuryClient/invalidEventSignature.schema.js +25 -0
  7. package/build/esm/.spruce/errors/mercuryClient/invalidPayload.schema.d.ts +3 -0
  8. package/build/esm/.spruce/errors/mercuryClient/invalidPayload.schema.js +19 -0
  9. package/build/esm/.spruce/errors/mercuryClient/invalidProtocol.schema.d.ts +3 -0
  10. package/build/esm/.spruce/errors/mercuryClient/invalidProtocol.schema.js +19 -0
  11. package/build/esm/.spruce/errors/mercuryClient/missingTestCacheDir.schema.d.ts +3 -0
  12. package/build/esm/.spruce/errors/mercuryClient/missingTestCacheDir.schema.js +12 -0
  13. package/build/esm/.spruce/errors/mercuryClient/mustCreateEvent.schema.d.ts +3 -0
  14. package/build/esm/.spruce/errors/mercuryClient/mustCreateEvent.schema.js +19 -0
  15. package/build/esm/.spruce/errors/mercuryClient/mustHandleLocally.schema.d.ts +3 -0
  16. package/build/esm/.spruce/errors/mercuryClient/mustHandleLocally.schema.js +19 -0
  17. package/build/esm/.spruce/errors/mercuryClient/notConnected.schema.d.ts +3 -0
  18. package/build/esm/.spruce/errors/mercuryClient/notConnected.schema.js +25 -0
  19. package/build/esm/.spruce/errors/mercuryClient/timeout.schema.d.ts +3 -0
  20. package/build/esm/.spruce/errors/mercuryClient/timeout.schema.js +35 -0
  21. package/build/esm/.spruce/errors/mercuryClient/unauthorizedAccess.schema.d.ts +3 -0
  22. package/build/esm/.spruce/errors/mercuryClient/unauthorizedAccess.schema.js +41 -0
  23. package/build/esm/.spruce/errors/mercuryClient/unauthorizedTarget.schema.d.ts +3 -0
  24. package/build/esm/.spruce/errors/mercuryClient/unauthorizedTarget.schema.js +38 -0
  25. package/build/esm/.spruce/errors/mercuryClient/unexpectedPayload.schema.d.ts +3 -0
  26. package/build/esm/.spruce/errors/mercuryClient/unexpectedPayload.schema.js +19 -0
  27. package/build/esm/.spruce/errors/mercuryClient/unknownError.schema.d.ts +3 -0
  28. package/build/esm/.spruce/errors/mercuryClient/unknownError.schema.js +12 -0
  29. package/build/esm/.spruce/errors/options.types.d.ts +40 -0
  30. package/build/esm/.spruce/errors/options.types.js +1 -0
  31. package/build/esm/.spruce/event-cache.json +1 -0
  32. package/build/esm/.spruce/schemas/fields/fieldClassMap.d.ts +2 -0
  33. package/build/esm/.spruce/schemas/fields/fieldClassMap.js +5 -0
  34. package/build/esm/.spruce/schemas/fields/fields.types.d.ts +1 -0
  35. package/build/esm/.spruce/schemas/fields/fields.types.js +3 -0
  36. package/build/esm/.spruce/schemas/schemas.types.d.ts +1 -0
  37. package/build/esm/.spruce/schemas/schemas.types.js +3 -0
  38. package/build/esm/.spruce/settings.json +26 -0
  39. package/build/esm/clients/MercuryClientFactory.d.ts +26 -0
  40. package/build/esm/clients/MercuryClientFactory.js +96 -0
  41. package/build/esm/clients/MercurySocketIoClient.d.ts +89 -0
  42. package/build/esm/clients/MercurySocketIoClient.js +605 -0
  43. package/build/esm/clients/MercuryTestClient.d.ts +57 -0
  44. package/build/esm/clients/MercuryTestClient.js +389 -0
  45. package/build/esm/clients/MutableContractClient.d.ts +10 -0
  46. package/build/esm/clients/MutableContractClient.js +43 -0
  47. package/build/esm/clients/statusChangePayloadSchema.d.ts +103 -0
  48. package/build/esm/clients/statusChangePayloadSchema.js +45 -0
  49. package/build/esm/constants.d.ts +1 -0
  50. package/build/esm/constants.js +1 -0
  51. package/build/esm/errors/SpruceError.d.ts +5 -0
  52. package/build/esm/errors/SpruceError.js +66 -0
  53. package/build/esm/errors/connectionFailed.builder.d.ts +16 -0
  54. package/build/esm/errors/connectionFailed.builder.js +16 -0
  55. package/build/esm/errors/invalidEventSignature.builder.d.ts +15 -0
  56. package/build/esm/errors/invalidEventSignature.builder.js +15 -0
  57. package/build/esm/errors/invalidPayload.builder.d.ts +12 -0
  58. package/build/esm/errors/invalidPayload.builder.js +12 -0
  59. package/build/esm/errors/invalidProtocol.builder.d.ts +12 -0
  60. package/build/esm/errors/invalidProtocol.builder.js +12 -0
  61. package/build/esm/errors/missingTestCacheDir.builder.d.ts +7 -0
  62. package/build/esm/errors/missingTestCacheDir.builder.js +7 -0
  63. package/build/esm/errors/mustCreateEvent.builder.d.ts +11 -0
  64. package/build/esm/errors/mustCreateEvent.builder.js +11 -0
  65. package/build/esm/errors/mustHandleLocally.builder.d.ts +11 -0
  66. package/build/esm/errors/mustHandleLocally.builder.js +11 -0
  67. package/build/esm/errors/notConnected.builder.d.ts +16 -0
  68. package/build/esm/errors/notConnected.builder.js +16 -0
  69. package/build/esm/errors/timeout.builder.d.ts +22 -0
  70. package/build/esm/errors/timeout.builder.js +22 -0
  71. package/build/esm/errors/unauthorizedAccess.builder.d.ts +57 -0
  72. package/build/esm/errors/unauthorizedAccess.builder.js +39 -0
  73. package/build/esm/errors/unexpectedPayload.builder.d.ts +12 -0
  74. package/build/esm/errors/unexpectedPayload.builder.js +12 -0
  75. package/build/esm/errors/unknownError.builder.d.ts +6 -0
  76. package/build/esm/errors/unknownError.builder.js +6 -0
  77. package/build/esm/index.d.ts +6 -0
  78. package/build/esm/index.js +6 -0
  79. package/build/esm/tests/AbstractClientTest.d.ts +31 -0
  80. package/build/esm/tests/AbstractClientTest.js +212 -0
  81. package/build/esm/tests/constants.d.ts +9 -0
  82. package/build/esm/tests/constants.js +11 -0
  83. package/build/esm/types/client.types.d.ts +30 -0
  84. package/build/esm/types/client.types.js +1 -0
  85. package/build/esm/utilities/socketIoEventUtil.utility.d.ts +5 -0
  86. package/build/esm/utilities/socketIoEventUtil.utility.js +9 -0
  87. package/package.json +12 -12
  88. package/build/__tests__/behavioral/AuthenticatingAndReauthenticating.test.d.ts +0 -21
  89. package/build/__tests__/behavioral/AuthenticatingAndReauthenticating.test.js +0 -287
  90. package/build/__tests__/behavioral/AuthenticatingAndReauthenticating.test.js.map +0 -1
  91. package/build/__tests__/behavioral/DisablingPermissionChecksWhenEmittingLocally.test.d.ts +0 -7
  92. package/build/__tests__/behavioral/DisablingPermissionChecksWhenEmittingLocally.test.js +0 -49
  93. package/build/__tests__/behavioral/DisablingPermissionChecksWhenEmittingLocally.test.js.map +0 -1
  94. package/build/__tests__/behavioral/EmittingAndFlatteningResponses.test.d.ts +0 -52
  95. package/build/__tests__/behavioral/EmittingAndFlatteningResponses.test.js +0 -123
  96. package/build/__tests__/behavioral/EmittingAndFlatteningResponses.test.js.map +0 -1
  97. package/build/__tests__/behavioral/EmittingConnectionChangeInTests.test.d.ts +0 -9
  98. package/build/__tests__/behavioral/EmittingConnectionChangeInTests.test.js +0 -103
  99. package/build/__tests__/behavioral/EmittingConnectionChangeInTests.test.js.map +0 -1
  100. package/build/__tests__/behavioral/LocallyHandlingAuthenticateDelaysConnect.test.d.ts +0 -7
  101. package/build/__tests__/behavioral/LocallyHandlingAuthenticateDelaysConnect.test.js +0 -91
  102. package/build/__tests__/behavioral/LocallyHandlingAuthenticateDelaysConnect.test.js.map +0 -1
  103. package/build/__tests__/behavioral/MercuryClientFactory.test.d.ts +0 -7
  104. package/build/__tests__/behavioral/MercuryClientFactory.test.js +0 -85
  105. package/build/__tests__/behavioral/MercuryClientFactory.test.js.map +0 -1
  106. package/build/__tests__/behavioral/ProxyingEvents.test.d.ts +0 -11
  107. package/build/__tests__/behavioral/ProxyingEvents.test.js +0 -99
  108. package/build/__tests__/behavioral/ProxyingEvents.test.js.map +0 -1
  109. package/build/__tests__/behavioral/ReconnectingAutomatically.test.d.ts +0 -33
  110. package/build/__tests__/behavioral/ReconnectingAutomatically.test.js +0 -390
  111. package/build/__tests__/behavioral/ReconnectingAutomatically.test.js.map +0 -1
  112. package/build/__tests__/behavioral/RequiringLocalListeners.test.d.ts +0 -7
  113. package/build/__tests__/behavioral/RequiringLocalListeners.test.js +0 -65
  114. package/build/__tests__/behavioral/RequiringLocalListeners.test.js.map +0 -1
  115. package/build/__tests__/behavioral/SettingNamespacesThatMustBeHandledLocally.test.d.ts +0 -9
  116. package/build/__tests__/behavioral/SettingNamespacesThatMustBeHandledLocally.test.js +0 -66
  117. package/build/__tests__/behavioral/SettingNamespacesThatMustBeHandledLocally.test.js.map +0 -1
  118. package/build/__tests__/behavioral/SimulatingEventsForTesting.test.d.ts +0 -51
  119. package/build/__tests__/behavioral/SimulatingEventsForTesting.test.js +0 -821
  120. package/build/__tests__/behavioral/SimulatingEventsForTesting.test.js.map +0 -1
  121. package/build/__tests__/behavioral/TestClientSpeedTests.test.d.ts +0 -7
  122. package/build/__tests__/behavioral/TestClientSpeedTests.test.js +0 -44
  123. package/build/__tests__/behavioral/TestClientSpeedTests.test.js.map +0 -1
  124. package/build/__tests__/behavioral/TestingWithDefaultContracts.test.d.ts +0 -7
  125. package/build/__tests__/behavioral/TestingWithDefaultContracts.test.js +0 -56
  126. package/build/__tests__/behavioral/TestingWithDefaultContracts.test.js.map +0 -1
  127. package/build/__tests__/behavioral/TurningOffAListener.test.d.ts +0 -16
  128. package/build/__tests__/behavioral/TurningOffAListener.test.js +0 -126
  129. package/build/__tests__/behavioral/TurningOffAListener.test.js.map +0 -1
  130. package/build/__tests__/behavioral/UsingMercuryClient.test.d.ts +0 -45
  131. package/build/__tests__/behavioral/UsingMercuryClient.test.js +0 -662
  132. package/build/__tests__/behavioral/UsingMercuryClient.test.js.map +0 -1
  133. /package/build/{.spruce → esm/.spruce}/errors/errors.types.js.map +0 -0
  134. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/connectionFailed.schema.js.map +0 -0
  135. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/invalidEventSignature.schema.js.map +0 -0
  136. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/invalidPayload.schema.js.map +0 -0
  137. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/invalidProtocol.schema.js.map +0 -0
  138. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/missingTestCacheDir.schema.js.map +0 -0
  139. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/mustCreateEvent.schema.js.map +0 -0
  140. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/mustHandleLocally.schema.js.map +0 -0
  141. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/notConnected.schema.js.map +0 -0
  142. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/timeout.schema.js.map +0 -0
  143. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/unauthorizedAccess.schema.js.map +0 -0
  144. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/unauthorizedTarget.schema.js.map +0 -0
  145. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/unexpectedPayload.schema.js.map +0 -0
  146. /package/build/{.spruce → esm/.spruce}/errors/mercuryClient/unknownError.schema.js.map +0 -0
  147. /package/build/{.spruce → esm/.spruce}/errors/options.types.js.map +0 -0
  148. /package/build/{.spruce → esm/.spruce}/schemas/fields/fieldClassMap.js.map +0 -0
  149. /package/build/{.spruce → esm/.spruce}/schemas/fields/fields.types.js.map +0 -0
  150. /package/build/{.spruce → esm/.spruce}/schemas/schemas.types.js.map +0 -0
  151. /package/build/{clients → esm/clients}/MercuryClientFactory.js.map +0 -0
  152. /package/build/{clients → esm/clients}/MercurySocketIoClient.js.map +0 -0
  153. /package/build/{clients → esm/clients}/MercuryTestClient.js.map +0 -0
  154. /package/build/{clients → esm/clients}/MutableContractClient.js.map +0 -0
  155. /package/build/{clients → esm/clients}/statusChangePayloadSchema.js.map +0 -0
  156. /package/build/{constants.js.map → esm/constants.js.map} +0 -0
  157. /package/build/{errors → esm/errors}/SpruceError.js.map +0 -0
  158. /package/build/{errors → esm/errors}/connectionFailed.builder.js.map +0 -0
  159. /package/build/{errors → esm/errors}/invalidEventSignature.builder.js.map +0 -0
  160. /package/build/{errors → esm/errors}/invalidPayload.builder.js.map +0 -0
  161. /package/build/{errors → esm/errors}/invalidProtocol.builder.js.map +0 -0
  162. /package/build/{errors → esm/errors}/missingTestCacheDir.builder.js.map +0 -0
  163. /package/build/{errors → esm/errors}/mustCreateEvent.builder.js.map +0 -0
  164. /package/build/{errors → esm/errors}/mustHandleLocally.builder.js.map +0 -0
  165. /package/build/{errors → esm/errors}/notConnected.builder.js.map +0 -0
  166. /package/build/{errors → esm/errors}/timeout.builder.js.map +0 -0
  167. /package/build/{errors → esm/errors}/unauthorizedAccess.builder.js.map +0 -0
  168. /package/build/{errors → esm/errors}/unexpectedPayload.builder.js.map +0 -0
  169. /package/build/{errors → esm/errors}/unknownError.builder.js.map +0 -0
  170. /package/build/{index.js.map → esm/index.js.map} +0 -0
  171. /package/build/{tests → esm/tests}/AbstractClientTest.js.map +0 -0
  172. /package/build/{tests → esm/tests}/constants.js.map +0 -0
  173. /package/build/{types → esm/types}/client.types.js.map +0 -0
  174. /package/build/{utilities → esm/utilities}/socketIoEventUtil.utility.js.map +0 -0
@@ -1,821 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const mercury_core_events_1 = require("@sprucelabs/mercury-core-events");
13
- const mercury_types_1 = require("@sprucelabs/mercury-types");
14
- const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
15
- const test_utils_1 = require("@sprucelabs/test-utils");
16
- const test_utils_2 = require("@sprucelabs/test-utils");
17
- const __1 = require("../..");
18
- const SpruceError_1 = __importDefault(require("../../errors/SpruceError"));
19
- const AbstractClientTest_1 = __importDefault(require("../../tests/AbstractClientTest"));
20
- const constants_1 = require("../../tests/constants");
21
- class SimulatingEventsForTestingTest extends AbstractClientTest_1.default {
22
- static async beforeEach() {
23
- await super.beforeEach();
24
- __1.MercuryTestClient.setShouldRequireLocalListeners(false);
25
- }
26
- static testModeFalseByDefault() {
27
- test_utils_1.assert.isFalse(__1.MercuryClientFactory.isInTestMode());
28
- }
29
- static async canSetTestMode() {
30
- this.enableTestMode();
31
- test_utils_1.assert.isTrue(__1.MercuryClientFactory.isInTestMode());
32
- }
33
- static async testClientHandlesDefaultContracts() {
34
- const client = await this.connectToApiAsTestClient(true);
35
- test_utils_1.assert.isTrue(client.doesHandleEvent(this.eventName));
36
- test_utils_1.assert.isFalse(client.doesHandleEvent('taco-bravo'));
37
- await client.disconnect();
38
- }
39
- static async clientKnowsIfIsTestClient() {
40
- __1.MercuryClientFactory.setIsTestMode(false);
41
- const client = await __1.MercuryClientFactory.Client({
42
- host: constants_1.TEST_HOST,
43
- allowSelfSignedCrt: true,
44
- });
45
- test_utils_1.assert.isFalse(client.getIsTestClient());
46
- this.enableTestMode();
47
- const client2 = await __1.MercuryClientFactory.Client({
48
- host: constants_1.TEST_HOST,
49
- allowSelfSignedCrt: true,
50
- });
51
- test_utils_1.assert.isTrue(client2.getIsTestClient());
52
- }
53
- static async canEmitEventToSelfForTesting(shouldSetDefaultContract) {
54
- const client = await this.connectToApiAsTestClient(shouldSetDefaultContract);
55
- let wasFired = false;
56
- await client.on('did-message::v2020_12_25', async () => {
57
- wasFired = true;
58
- });
59
- await client.emit('did-message::v2020_12_25', {
60
- target: {},
61
- payload: {
62
- message: {
63
- id: 'test',
64
- source: {},
65
- target: {},
66
- body: 'message body',
67
- classification: 'incoming',
68
- dateCreated: 1,
69
- },
70
- },
71
- });
72
- test_utils_1.assert.isTrue(wasFired);
73
- }
74
- static async canEmitToApiWhenNoLocalListenerIsSet() {
75
- const client = await this.connectToApiAsTestClient();
76
- const results = await client.emit('get-event-contracts::v2020_12_25');
77
- const { contracts } = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results);
78
- test_utils_1.assert.isArray(contracts);
79
- test_utils_1.assert.isObject(contracts[0]);
80
- test_utils_1.assert.isObject(contracts[0].eventSignatures['get-event-contracts::v2020_12_25']);
81
- }
82
- static async canHandleRapidFireConnectsToApi() {
83
- const client = await this.connectToApiAsTestClient();
84
- await Promise.all([
85
- client.emit('get-event-contracts::v2020_12_25'),
86
- client.emit('get-event-contracts::v2020_12_25'),
87
- client.emit('get-event-contracts::v2020_12_25'),
88
- ]);
89
- }
90
- static async canEmitToSelfUsingToClients() {
91
- const [client1, client2] = await Promise.all([
92
- this.connectToApiAsTestClient(),
93
- this.connectToApiAsTestClient(),
94
- ]);
95
- let wasFired = false;
96
- await client1.on('did-message::v2020_12_25', async () => {
97
- wasFired = true;
98
- });
99
- await client2.emit('did-message::v2020_12_25', {
100
- target: {},
101
- payload: {
102
- message: {
103
- id: 'test',
104
- source: {},
105
- target: {},
106
- body: 'message body',
107
- classification: 'incoming',
108
- dateCreated: 1,
109
- },
110
- },
111
- });
112
- test_utils_1.assert.isTrue(wasFired);
113
- }
114
- static async factoryReturnsSocketIoClient() {
115
- const client = await this.connectToApiAsTestClient();
116
- test_utils_1.assert.isTrue(client.isConnected());
117
- await client.disconnect();
118
- test_utils_1.assert.isFalse(client.isConnected());
119
- }
120
- static async canResetClient() {
121
- const client = await this.connectToApiAsTestClient();
122
- __1.MercuryTestClient.reset();
123
- const err = await test_utils_1.assert.doesThrowAsync(() => client.on('did-message::v2020_12_25', async () => { }));
124
- test_utils_2.errorAssert.assertError(err, 'INVALID_EVENT_NAME');
125
- }
126
- static async canMixinContractsToTestClient() {
127
- const [client1, client2] = await Promise.all([
128
- this.connectToApiAsTestClient(),
129
- this.connectToApiAsTestClient(),
130
- ]);
131
- this.mixinPayloadLessTestEvent(client1);
132
- let hit = false;
133
- //@ts-ignore
134
- await client2.on(this.testEventName, () => {
135
- hit = true;
136
- });
137
- //@ts-ignore
138
- await client1.emit(this.testEventName);
139
- test_utils_1.assert.isTruthy(hit);
140
- }
141
- static async firstTestClientAddsEventToSecondTestClient() {
142
- const client1 = await this.connectToApiAsTestClient(false, {
143
- eventSignatures: {
144
- 'my-new-event': {},
145
- },
146
- });
147
- const client2 = await this.connectToApiAsTestClient();
148
- test_utils_1.assert.isTrue(client1.doesHandleEvent('my-new-event'));
149
- test_utils_1.assert.isTrue(client2.doesHandleEvent('my-new-event'));
150
- }
151
- static async secondTestClientAddsEventToFirstTestClient() {
152
- const client1 = await this.connectToApiAsTestClient();
153
- const client2 = await this.connectToApiAsTestClient(false, {
154
- eventSignatures: {
155
- 'my-new-event': {},
156
- },
157
- });
158
- test_utils_1.assert.isTrue(client1.doesHandleEvent('my-new-event'));
159
- test_utils_1.assert.isTrue(client2.doesHandleEvent('my-new-event'));
160
- }
161
- static async includesSourceInEventsEmittedByPerson() {
162
- const [client2, { client: client1, person }] = await Promise.all([
163
- this.connectToApiAsTestClient(),
164
- this.loginAsDemoPerson(),
165
- ]);
166
- this.mixinPayloadLessTestEvent(client1);
167
- let s;
168
- //@ts-ignore
169
- await client2.on(this.testEventName, ({ source }) => {
170
- s = source;
171
- });
172
- //@ts-ignore
173
- await client1.emit(this.testEventName);
174
- test_utils_1.assert.isTruthy(s.personId);
175
- test_utils_1.assert.isEqual(s.personId, person.id);
176
- test_utils_1.assert.isUndefined(s.skillId);
177
- }
178
- static async doesCheckPermsIfPermissionsIsEmptyArrayOnContract(expected) {
179
- __1.MercuryTestClient.setShouldCheckPermissionsOnLocalEvents(expected);
180
- const [client2, { client: client1 }] = await Promise.all([
181
- this.connectToApiAsTestClient(),
182
- this.loginAsDemoPerson(),
183
- ]);
184
- const contract = {
185
- eventSignatures: {
186
- [this.testEventName]: {
187
- isGlobal: true,
188
- emitPermissionContract: {
189
- id: 'test',
190
- name: 'Can emit',
191
- permissions: [],
192
- },
193
- responsePayloadSchema: {
194
- id: 'response',
195
- fields: {
196
- hit: {
197
- type: 'boolean',
198
- },
199
- },
200
- },
201
- },
202
- },
203
- };
204
- client2.mixinContract(contract);
205
- let wasHit = false;
206
- await client1.on('does-honor-permission-contract::v2020_12_25', () => {
207
- wasHit = true;
208
- return {
209
- doesHonor: false,
210
- };
211
- });
212
- let s;
213
- //@ts-ignore
214
- await client1.on(this.testEventName, ({ source }) => {
215
- s = source;
216
- });
217
- //@ts-ignore
218
- const results = await client1.emit(this.testEventName);
219
- if (expected) {
220
- test_utils_1.assert.isAbove(results.totalErrors, 0);
221
- test_utils_1.assert.isFalsy(s);
222
- }
223
- else {
224
- test_utils_1.assert.isTruthy(s);
225
- test_utils_1.assert.isEqual(results.totalErrors, 0);
226
- }
227
- test_utils_1.assert.isEqual(wasHit, expected);
228
- }
229
- static async stillValidatesPayloads() {
230
- const [client1, client2] = await Promise.all([
231
- this.connectToApiAsTestClient(true),
232
- this.connectToApiAsTestClient(true),
233
- ]);
234
- let hit = false;
235
- await client2.on('confirm-pin::v2020_12_25', async () => {
236
- hit = true;
237
- return {
238
- token: 'yes!',
239
- person: {},
240
- };
241
- });
242
- const err = await test_utils_1.assert.doesThrowAsync(() => client1.emit('confirm-pin::v2020_12_25', {
243
- //@ts-ignore
244
- fails: true,
245
- }));
246
- test_utils_2.errorAssert.assertError(err, 'INVALID_PAYLOAD');
247
- test_utils_1.assert.isFalse(hit);
248
- }
249
- static async includesSourceInEventsEmittedBySkill() {
250
- const { personClient, skill1Client, skill2Client, skill1 } = await this.setupOrgAndInstall2Skills();
251
- this.mixinPayloadLessTestEvent(personClient);
252
- let s;
253
- //@ts-ignore
254
- await skill2Client.on(this.testEventName, ({ source }) => {
255
- s = source;
256
- });
257
- //@ts-ignore
258
- await skill1Client.emit(this.testEventName);
259
- test_utils_1.assert.isTruthy(s.skillId);
260
- test_utils_1.assert.isEqual(s.skillId, skill1.id);
261
- test_utils_1.assert.isUndefined(s.personId);
262
- }
263
- static async checksPermissionsWhenEmitting() {
264
- __1.MercuryTestClient.setShouldCheckPermissionsOnLocalEvents(true);
265
- const { skill1, skill1Client, skill2Client, org, personClient } = await this.setupOrgAndInstall2Skills();
266
- const eventName = 'event-with-emit-permissions::v2020_05_19';
267
- const fqen = `${skill1.slug}.event-with-emit-permissions::v2020_05_19`;
268
- const targetWithOrgId = (0, spruce_event_utils_1.buildEmitTargetAndPayloadSchema)({
269
- eventName,
270
- targetSchema: {
271
- id: 'test-target',
272
- fields: {
273
- organizationId: {
274
- type: 'id',
275
- isRequired: true,
276
- },
277
- },
278
- },
279
- });
280
- //@ts-ignore
281
- skill1Client.mixinContract({
282
- eventSignatures: {
283
- [fqen]: {
284
- emitPayloadSchema: targetWithOrgId,
285
- emitPermissionContract: this.buildEmitPermContract(),
286
- },
287
- },
288
- });
289
- const registerEventResults = await skill1Client.emit('register-events::v2020_12_25', {
290
- payload: {
291
- contract: {
292
- eventSignatures: {
293
- [eventName]: {
294
- emitPayloadSchema: targetWithOrgId,
295
- emitPermissionContract: this.buildEmitPermContract(),
296
- },
297
- },
298
- },
299
- },
300
- });
301
- spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(registerEventResults);
302
- await skill1Client.on(fqen, async () => { });
303
- await this.assertGuestCantEmit(fqen, org.id);
304
- await this.assertAnonCantEmit(fqen, org.id);
305
- await this.assertAnotherSkillCantEmit(fqen, skill2Client, org.id);
306
- await this.assertTeammateCanEmit({
307
- fqen,
308
- ownerClient: personClient,
309
- organizationId: org.id,
310
- });
311
- }
312
- static async localResponsesAreValidated() {
313
- const [client1, client2] = await Promise.all([
314
- this.connectToApiAsTestClient(true),
315
- this.connectToApiAsTestClient(true),
316
- ]);
317
- //@ts-ignore
318
- await client2.on('confirm-pin::v2020_12_25', async () => {
319
- return {
320
- token: 'yes!',
321
- taco: {},
322
- };
323
- });
324
- const results = await client1.emit('confirm-pin::v2020_12_25', {
325
- payload: {
326
- challenge: '1234',
327
- pin: '0000',
328
- },
329
- });
330
- test_utils_1.assert.isEqual(results.totalErrors, 1);
331
- spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(results, 'INVALID_RESPONSE_PAYLOAD');
332
- }
333
- static async responseThrowingAnErrorIsPassedThrough() {
334
- const [client1, client2] = await Promise.all([
335
- this.connectToApiAsTestClient(true),
336
- this.connectToApiAsTestClient(true),
337
- ]);
338
- //@ts-ignore
339
- await client2.on('confirm-pin::v2020_12_25', async () => {
340
- //@ts-ignore
341
- throw new SpruceError_1.default({ code: 'TEST' });
342
- });
343
- const results = await client1.emit('confirm-pin::v2020_12_25', {
344
- payload: {
345
- challenge: '1234',
346
- pin: '0000',
347
- },
348
- });
349
- test_utils_1.assert.isEqual(results.totalErrors, 1);
350
- spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(results, 'TEST');
351
- }
352
- static async testClientWrapsUnknownEventNameInHelpfulDebugError() {
353
- const client = await this.connectToApiAsTestClient(true);
354
- //@ts-ignore
355
- const err = await test_utils_1.assert.doesThrowAsync(() => client.emit('waka-waka'));
356
- test_utils_1.assert.doesInclude(err.message, 'spruce create.event');
357
- }
358
- static async returnsHelpfulErrorIfEventExistsLocallyButNotRemotely() {
359
- const client = await this.connectToApiAsTestClient(true);
360
- __1.MercuryTestClient.getInternalEmitter().mixinContract({
361
- eventSignatures: {
362
- ['waka-waka']: {},
363
- },
364
- });
365
- //@ts-ignore
366
- const results = await client.emit('waka-waka');
367
- const err = spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(results, 'INVALID_EVENT_NAME');
368
- test_utils_1.assert.doesInclude(err.message, 'create.listener');
369
- }
370
- static async passesThroughProxyIfSetOnClient() {
371
- const { personClient, skill1Client, skill2Client, skill1 } = await this.setupOrgAndInstall2Skills();
372
- this.mixinPayloadLessTestEvent(personClient);
373
- let s;
374
- //@ts-ignore
375
- await skill2Client.on(this.testEventName, ({ source }) => {
376
- s = source;
377
- });
378
- const proxyToken = 'toast-cheese';
379
- skill1Client.setProxyToken(proxyToken);
380
- //@ts-ignore
381
- await skill1Client.emit(this.testEventName);
382
- test_utils_1.assert.isTruthy(s.skillId);
383
- test_utils_1.assert.isEqual(s.skillId, skill1.id);
384
- test_utils_1.assert.isUndefined(s.personId);
385
- test_utils_1.assert.isEqual(s.proxyToken, proxyToken);
386
- }
387
- static async passesThroughProxyIfSentWithPayload() {
388
- const { personClient, skill1Client, skill2Client, skill1 } = await this.setupOrgAndInstall2Skills();
389
- this.mixinPayloadLessTestEventWithSource(personClient);
390
- let s;
391
- //@ts-ignore
392
- await skill2Client.on(this.testEventName, ({ source }) => {
393
- s = source;
394
- });
395
- const proxyToken = 'waste-taco';
396
- skill1Client.setProxyToken('this-should-be-ignored-now');
397
- //@ts-ignore
398
- await skill1Client.emit(this.testEventName, {
399
- source: {
400
- proxyToken,
401
- },
402
- });
403
- test_utils_1.assert.isTruthy(s.skillId);
404
- test_utils_1.assert.isEqual(s.skillId, skill1.id);
405
- test_utils_1.assert.isUndefined(s.personId);
406
- test_utils_1.assert.isEqual(s.proxyToken, proxyToken);
407
- }
408
- static async throwsIfEmitsIsNotGlobalAndTargetDoesNotIncludeOrganizationIdOrLocationId() {
409
- __1.MercuryTestClient.setShouldCheckPermissionsOnLocalEvents(false);
410
- const client = await this.connectToApiAsTestClient(true);
411
- const client2 = await this.connectToApiAsTestClient(true);
412
- const contract = {
413
- eventSignatures: {
414
- [this.testEventName]: {
415
- emitPermissionContract: {
416
- id: 'test',
417
- name: 'Can emit',
418
- permissions: [],
419
- },
420
- },
421
- },
422
- };
423
- client.mixinContract(contract);
424
- await client.on(this.testEventName, () => { });
425
- const err = await test_utils_1.assert.doesThrowAsync(() => client2.emit(this.testEventName));
426
- test_utils_2.errorAssert.assertError(err, 'INVALID_EVENT_SIGNATURE');
427
- }
428
- static async passesThroughTestProxy() {
429
- this.enableTestMode();
430
- const { client: teammateClient } = await this.loginAsDemoPerson(constants_1.DEMO_PHONE_TEAMMATE);
431
- const { client: guestClient } = await this.loginAsDemoPerson(constants_1.DEMO_PHONE_GUEST);
432
- const client = await this.connectToApiAsTestClient();
433
- let passedSource;
434
- await client.on('whoami::v2020_12_25', async ({ source }) => {
435
- passedSource = source;
436
- return {};
437
- });
438
- const teammateToken = await teammateClient.registerProxyToken();
439
- guestClient.setProxyToken(teammateToken);
440
- await guestClient.emit('whoami::v2020_12_25');
441
- test_utils_1.assert.isEqual(passedSource.proxyToken, teammateToken);
442
- }
443
- static async proxyNotSentToAuthenticate() {
444
- const client = await this.enableTestModeAndLoginAsGuest();
445
- const token = await client.registerProxyToken();
446
- let passedSource;
447
- //@ts-ignore
448
- await client.on('authenticate::v2020_12_25', ({ source }) => {
449
- passedSource = source;
450
- return {
451
- type: 'authenticated',
452
- auth: {},
453
- };
454
- });
455
- const anon = await this.connectToApiAsTestClient();
456
- anon.setProxyToken(token);
457
- await anon.authenticate({
458
- token: '234234234234',
459
- });
460
- test_utils_1.assert.isFalsy(passedSource?.proxyToken);
461
- }
462
- static async throwsWhenPassingEmptyTargetAndPayloadToEVentWithNoEmitPayloadSchema() {
463
- const client = await this.enableTestModeAndLoginAsGuest();
464
- //@ts-ignore
465
- delete client.eventContract.eventSignatures['whoami::v2020_12_25']
466
- .emitPayloadSchema;
467
- await client.on('whoami::v2020_12_25', () => ({
468
- type: 'anonymous',
469
- auth: {},
470
- }));
471
- await test_utils_1.assert.doesThrowAsync(() => client.emit('whoami::v2020_12_25', {}));
472
- }
473
- static async callbackInvokedForEachResponse() {
474
- const client = await this.enableTestModeAndLoginAsGuest();
475
- await client.on('list-organizations::v2020_12_25', () => {
476
- return {
477
- organizations: [],
478
- };
479
- });
480
- let wasHit = false;
481
- await client.emit('list-organizations::v2020_12_25', () => {
482
- wasHit = true;
483
- });
484
- test_utils_1.assert.isTrue(wasHit);
485
- }
486
- static async fakedResponsesAreCloned() {
487
- const client = await this.enableTestModeAndLoginAsGuest();
488
- const org = {
489
- id: '1234',
490
- name: 'Pal',
491
- dateCreated: 0,
492
- slug: 'buddy',
493
- };
494
- await client.on('list-organizations::v2020_12_25', () => {
495
- return {
496
- organizations: [org],
497
- };
498
- });
499
- const [{ organizations }] = await client.emitAndFlattenResponses('list-organizations::v2020_12_25');
500
- test_utils_1.assert.isNotEqual(organizations[0], org);
501
- }
502
- static async offHonorsCb() {
503
- const client = await this.enableTestModeAndLoginAsGuest();
504
- let cb1Hit = 0;
505
- let cb2Hit = 0;
506
- const cb1 = () => {
507
- cb1Hit++;
508
- return {
509
- type: 'anonymous',
510
- auth: {},
511
- };
512
- };
513
- const cb2 = () => {
514
- cb2Hit++;
515
- return {
516
- type: 'anonymous',
517
- auth: {},
518
- };
519
- };
520
- await client.on('whoami::v2020_12_25', cb1);
521
- await client.on('whoami::v2020_12_25', cb2);
522
- await client.off('whoami::v2020_12_25', cb2);
523
- await client.emit('whoami::v2020_12_25');
524
- test_utils_1.assert.isEqual(cb1Hit, 1);
525
- test_utils_1.assert.isEqual(cb2Hit, 0);
526
- }
527
- static async canEmitStatusChangeEventForTesting() {
528
- const client = await this.enableTestModeAndLoginAsGuest();
529
- let hit = false;
530
- await client.on('connection-status-change', () => {
531
- hit = true;
532
- });
533
- await client.emitAndFlattenResponses('connection-status-change', {
534
- payload: {
535
- status: 'connected',
536
- },
537
- });
538
- test_utils_1.assert.isTrue(hit);
539
- }
540
- static async payloadsAndResponsesAreCloned() {
541
- const client = await this.enableTestModeAndLoginAsGuest();
542
- const city = (0, test_utils_1.generateId)();
543
- const location1 = {
544
- id: (0, test_utils_1.generateId)(),
545
- dateCreated: 0,
546
- slug: (0, test_utils_1.generateId)(),
547
- name: (0, test_utils_1.generateId)(),
548
- organizationId: (0, test_utils_1.generateId)(),
549
- address: {
550
- city,
551
- country: (0, test_utils_1.generateId)(),
552
- province: (0, test_utils_1.generateId)(),
553
- street1: (0, test_utils_1.generateId)(),
554
- zip: (0, test_utils_1.generateId)(),
555
- },
556
- };
557
- let passedTarget;
558
- await client.on('get-location::v2020_12_25', ({ target }) => {
559
- passedTarget = target;
560
- return {
561
- location: location1,
562
- };
563
- });
564
- const target = {
565
- locationId: (0, test_utils_1.generateId)(),
566
- };
567
- const [{ location: results }] = await client.emitAndFlattenResponses('get-location::v2020_12_25', {
568
- target,
569
- });
570
- results.address.city = 'changed';
571
- test_utils_1.assert.isEqual(city, location1.address.city);
572
- test_utils_1.assert.isNotEqual(results.address, location1.address);
573
- test_utils_1.assert.isNotEqual(passedTarget, target);
574
- }
575
- static async loginAsGuest() {
576
- const { client } = await this.loginAsDemoPerson(constants_1.DEMO_PHONE_GUEST);
577
- return client;
578
- }
579
- static async assertTeammateCanEmit(options) {
580
- const { fqen, ownerClient, organizationId } = options;
581
- const { person: teammate, client: teammateClient } = await this.loginAsDemoPerson(constants_1.DEMO_PHONE_TEAMMATE);
582
- const roleResults = await ownerClient.emit('list-roles::v2020_12_25', {
583
- target: {
584
- organizationId,
585
- },
586
- payload: {
587
- shouldIncludePrivateRoles: true,
588
- },
589
- });
590
- const { roles } = spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(roleResults);
591
- const teammateRole = roles.find((r) => r.base === 'teammate');
592
- test_utils_1.assert.isTruthy(teammateRole);
593
- try {
594
- const roleSetResults = await ownerClient.emit('add-role::v2020_12_25', {
595
- target: {
596
- organizationId,
597
- },
598
- payload: {
599
- personId: teammate.id,
600
- roleId: teammateRole.id,
601
- },
602
- });
603
- spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(roleSetResults);
604
- }
605
- catch { }
606
- //@ts-ignore
607
- const response = await teammateClient.emit(fqen, {
608
- target: {
609
- organizationId,
610
- },
611
- });
612
- spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(response);
613
- }
614
- static async assertAnotherSkillCantEmit(fqen, skill2Client, orgId) {
615
- const results = await skill2Client.emit(fqen, {
616
- target: {
617
- organizationId: orgId,
618
- },
619
- });
620
- spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(results, 'UNAUTHORIZED_ACCESS');
621
- }
622
- static async assertGuestCantEmit(fqen, orgId) {
623
- const { client: personClient } = await this.loginAsDemoPerson(constants_1.DEMO_PHONE_GUEST);
624
- //@ts-ignore
625
- const response = await personClient.emit(fqen, {
626
- target: {
627
- organizationId: orgId,
628
- },
629
- });
630
- spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(response, 'UNAUTHORIZED_ACCESS');
631
- }
632
- static async assertAnonCantEmit(fqen, orgId) {
633
- const client = await this.connectToApiAsTestClient();
634
- //@ts-ignore
635
- const response = await client.emit(fqen, {
636
- target: {
637
- organizationId: orgId,
638
- },
639
- });
640
- spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(response, 'UNAUTHORIZED_ACCESS');
641
- }
642
- static buildEmitPermContract() {
643
- return (0, mercury_types_1.buildPermissionContract)({
644
- name: 'Can emit contract',
645
- id: 'can-do-something-contract',
646
- permissions: [
647
- {
648
- id: 'can-create',
649
- name: 'Can create',
650
- defaults: {
651
- teammate: {
652
- default: true,
653
- },
654
- },
655
- },
656
- ],
657
- });
658
- }
659
- static async setupOrgAndInstall2Skills() {
660
- this.enableTestMode();
661
- const { client: personClient } = await this.loginAsDemoPerson();
662
- const org = await this.seedDummyOrg(personClient);
663
- const { client: skill1Client, skill: skill1 } = await this.seedInstallAndLoginAsSkill(personClient, org.id);
664
- const { client: skill2Client } = await this.seedInstallAndLoginAsSkill(personClient, org.id);
665
- return { personClient, skill1, skill1Client, skill2Client, org };
666
- }
667
- static async connectToApiAsTestClient(shouldSetDefaultContract = false, contract) {
668
- this.enableTestMode();
669
- shouldSetDefaultContract &&
670
- __1.MercuryClientFactory.setDefaultContract(mercury_core_events_1.coreEventContracts[0]);
671
- const allContracts = [];
672
- if (!shouldSetDefaultContract) {
673
- allContracts.push(...mercury_core_events_1.coreEventContracts);
674
- }
675
- if (contract) {
676
- allContracts.push(contract);
677
- }
678
- const client = await __1.MercuryClientFactory.Client({
679
- host: constants_1.TEST_HOST,
680
- contracts: allContracts.length > 0 ? allContracts : undefined,
681
- allowSelfSignedCrt: true,
682
- });
683
- this.clients.push(client);
684
- return client;
685
- }
686
- static mixinPayloadLessTestEvent(client) {
687
- const contract = {
688
- eventSignatures: {
689
- [this.testEventName]: {
690
- isGlobal: true,
691
- },
692
- },
693
- };
694
- client.mixinContract(contract);
695
- }
696
- static enableTestMode() {
697
- __1.MercuryClientFactory.setIsTestMode(true);
698
- }
699
- static mixinPayloadLessTestEventWithSource(client) {
700
- const contract = {
701
- eventSignatures: {
702
- [this.testEventName]: {
703
- isGlobal: true,
704
- emitPayloadSchema: (0, spruce_event_utils_1.buildEmitTargetAndPayloadSchema)({
705
- eventName: this.testEventName,
706
- }),
707
- },
708
- },
709
- };
710
- client.mixinContract(contract);
711
- }
712
- static async enableTestModeAndLoginAsGuest() {
713
- this.enableTestMode();
714
- const client = await this.loginAsGuest();
715
- return client;
716
- }
717
- }
718
- SimulatingEventsForTestingTest.eventName = 'whoami::v2020_12_25';
719
- SimulatingEventsForTestingTest.testEventName = 'my-skill.test-event::v2020_02_02';
720
- exports.default = SimulatingEventsForTestingTest;
721
- __decorate([
722
- (0, test_utils_1.test)()
723
- ], SimulatingEventsForTestingTest, "testModeFalseByDefault", null);
724
- __decorate([
725
- (0, test_utils_1.test)()
726
- ], SimulatingEventsForTestingTest, "canSetTestMode", null);
727
- __decorate([
728
- (0, test_utils_1.test)()
729
- ], SimulatingEventsForTestingTest, "testClientHandlesDefaultContracts", null);
730
- __decorate([
731
- (0, test_utils_1.test)()
732
- ], SimulatingEventsForTestingTest, "clientKnowsIfIsTestClient", null);
733
- __decorate([
734
- (0, test_utils_1.test)('can emit to self with default contract', true),
735
- (0, test_utils_1.test)('can emit to self without default contract', false)
736
- ], SimulatingEventsForTestingTest, "canEmitEventToSelfForTesting", null);
737
- __decorate([
738
- (0, test_utils_1.test)()
739
- ], SimulatingEventsForTestingTest, "canEmitToApiWhenNoLocalListenerIsSet", null);
740
- __decorate([
741
- (0, test_utils_1.test)()
742
- ], SimulatingEventsForTestingTest, "canHandleRapidFireConnectsToApi", null);
743
- __decorate([
744
- (0, test_utils_1.test)()
745
- ], SimulatingEventsForTestingTest, "canEmitToSelfUsingToClients", null);
746
- __decorate([
747
- (0, test_utils_1.test)()
748
- ], SimulatingEventsForTestingTest, "factoryReturnsSocketIoClient", null);
749
- __decorate([
750
- (0, test_utils_1.test)()
751
- ], SimulatingEventsForTestingTest, "canResetClient", null);
752
- __decorate([
753
- (0, test_utils_1.test)()
754
- ], SimulatingEventsForTestingTest, "canMixinContractsToTestClient", null);
755
- __decorate([
756
- (0, test_utils_1.test)()
757
- ], SimulatingEventsForTestingTest, "firstTestClientAddsEventToSecondTestClient", null);
758
- __decorate([
759
- (0, test_utils_1.test)()
760
- ], SimulatingEventsForTestingTest, "secondTestClientAddsEventToFirstTestClient", null);
761
- __decorate([
762
- (0, test_utils_1.test)()
763
- ], SimulatingEventsForTestingTest, "includesSourceInEventsEmittedByPerson", null);
764
- __decorate([
765
- (0, test_utils_1.test)('does not check permissions by default', false),
766
- (0, test_utils_1.test)('does check permissions by default if array is empty', true)
767
- ], SimulatingEventsForTestingTest, "doesCheckPermsIfPermissionsIsEmptyArrayOnContract", null);
768
- __decorate([
769
- (0, test_utils_1.test)()
770
- ], SimulatingEventsForTestingTest, "stillValidatesPayloads", null);
771
- __decorate([
772
- (0, test_utils_1.test)()
773
- ], SimulatingEventsForTestingTest, "includesSourceInEventsEmittedBySkill", null);
774
- __decorate([
775
- (0, test_utils_1.test)()
776
- ], SimulatingEventsForTestingTest, "checksPermissionsWhenEmitting", null);
777
- __decorate([
778
- (0, test_utils_1.test)()
779
- ], SimulatingEventsForTestingTest, "localResponsesAreValidated", null);
780
- __decorate([
781
- (0, test_utils_1.test)()
782
- ], SimulatingEventsForTestingTest, "responseThrowingAnErrorIsPassedThrough", null);
783
- __decorate([
784
- (0, test_utils_1.test)()
785
- ], SimulatingEventsForTestingTest, "testClientWrapsUnknownEventNameInHelpfulDebugError", null);
786
- __decorate([
787
- (0, test_utils_1.test)()
788
- ], SimulatingEventsForTestingTest, "returnsHelpfulErrorIfEventExistsLocallyButNotRemotely", null);
789
- __decorate([
790
- (0, test_utils_1.test)()
791
- ], SimulatingEventsForTestingTest, "passesThroughProxyIfSetOnClient", null);
792
- __decorate([
793
- (0, test_utils_1.test)()
794
- ], SimulatingEventsForTestingTest, "passesThroughProxyIfSentWithPayload", null);
795
- __decorate([
796
- (0, test_utils_1.test)()
797
- ], SimulatingEventsForTestingTest, "throwsIfEmitsIsNotGlobalAndTargetDoesNotIncludeOrganizationIdOrLocationId", null);
798
- __decorate([
799
- (0, test_utils_1.test)()
800
- ], SimulatingEventsForTestingTest, "passesThroughTestProxy", null);
801
- __decorate([
802
- (0, test_utils_1.test)()
803
- ], SimulatingEventsForTestingTest, "proxyNotSentToAuthenticate", null);
804
- __decorate([
805
- (0, test_utils_1.test)()
806
- ], SimulatingEventsForTestingTest, "throwsWhenPassingEmptyTargetAndPayloadToEVentWithNoEmitPayloadSchema", null);
807
- __decorate([
808
- (0, test_utils_1.test)()
809
- ], SimulatingEventsForTestingTest, "callbackInvokedForEachResponse", null);
810
- __decorate([
811
- (0, test_utils_1.test)()
812
- ], SimulatingEventsForTestingTest, "fakedResponsesAreCloned", null);
813
- __decorate([
814
- (0, test_utils_1.test)()
815
- ], SimulatingEventsForTestingTest, "offHonorsCb", null);
816
- __decorate([
817
- (0, test_utils_1.test)()
818
- ], SimulatingEventsForTestingTest, "canEmitStatusChangeEventForTesting", null);
819
- __decorate([
820
- (0, test_utils_1.test)()
821
- ], SimulatingEventsForTestingTest, "payloadsAndResponsesAreCloned", null);