coveo.analytics 2.20.24 → 2.20.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.
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/coveoua/library.d.ts +1 -1
- package/dist/definitions/insight/insightClient.d.ts +24 -24
- package/dist/definitions/insight/insightEvents.d.ts +25 -7
- package/dist/definitions/searchPage/searchPageClient.d.ts +154 -73
- package/dist/definitions/src/coveoua/library.d.ts +1 -1
- package/dist/library.es.js +432 -150
- package/dist/library.js +477 -186
- package/package.json +1 -1
- package/src/coveoua/library.ts +6 -1
- package/src/insight/insightClient.spec.ts +495 -151
- package/src/insight/insightClient.ts +131 -91
- package/src/insight/insightEvents.ts +37 -6
- package/src/searchPage/searchPageClient.spec.ts +650 -5
- package/src/searchPage/searchPageClient.ts +460 -97
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {CoveoSearchPageClient, SearchPageClientProvider} from './searchPageClient';
|
|
1
|
+
import {CoveoSearchPageClient, EventDescription, SearchPageClientProvider} from './searchPageClient';
|
|
2
2
|
import {
|
|
3
3
|
SearchPageEvents,
|
|
4
4
|
PartialDocumentInformation,
|
|
@@ -120,6 +120,14 @@ describe('SearchPageClient', () => {
|
|
|
120
120
|
});
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
const expectMatchDescription = (description: EventDescription, actionCause: SearchPageEvents, meta = {}) => {
|
|
124
|
+
const customData = {foo: 'bar', ...meta};
|
|
125
|
+
expect(description).toMatchObject({
|
|
126
|
+
actionCause,
|
|
127
|
+
customData,
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
123
131
|
const expectMatchDocumentPayload = (actionCause: SearchPageEvents, doc: PartialDocumentInformation, meta = {}) => {
|
|
124
132
|
const [, {body}] = fetchMock.lastCall();
|
|
125
133
|
const customData = {foo: 'bar', ...meta};
|
|
@@ -174,6 +182,13 @@ describe('SearchPageClient', () => {
|
|
|
174
182
|
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
175
183
|
});
|
|
176
184
|
|
|
185
|
+
it('should send proper payload for #makeInterfaceLoad', async () => {
|
|
186
|
+
const built = client.makeInterfaceLoad();
|
|
187
|
+
await built.log();
|
|
188
|
+
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
189
|
+
expectMatchDescription(built.description, SearchPageEvents.interfaceLoad);
|
|
190
|
+
});
|
|
191
|
+
|
|
177
192
|
it('should send proper payload for #interfaceChange', async () => {
|
|
178
193
|
await client.logInterfaceChange({
|
|
179
194
|
interfaceChangeTo: 'bob',
|
|
@@ -181,39 +196,83 @@ describe('SearchPageClient', () => {
|
|
|
181
196
|
expectMatchPayload(SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});
|
|
182
197
|
});
|
|
183
198
|
|
|
199
|
+
it('should send proper payload for #makeInterfaceChange', async () => {
|
|
200
|
+
const built = client.makeInterfaceChange({interfaceChangeTo: 'bob'});
|
|
201
|
+
await built.log();
|
|
202
|
+
expectMatchPayload(SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});
|
|
203
|
+
expectMatchDescription(built.description, SearchPageEvents.interfaceChange, {interfaceChangeTo: 'bob'});
|
|
204
|
+
});
|
|
205
|
+
|
|
184
206
|
it('should send proper payload for #didyoumeanAutomatic', async () => {
|
|
185
207
|
await client.logDidYouMeanAutomatic();
|
|
186
208
|
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);
|
|
187
209
|
});
|
|
188
210
|
|
|
211
|
+
it('should send proper payload for #makeDidyoumeanAutomatic', async () => {
|
|
212
|
+
const built = client.makeDidYouMeanAutomatic();
|
|
213
|
+
await built.log();
|
|
214
|
+
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);
|
|
215
|
+
expectMatchDescription(built.description, SearchPageEvents.didyoumeanAutomatic);
|
|
216
|
+
});
|
|
217
|
+
|
|
189
218
|
it('should send proper payload for #didyoumeanClick', async () => {
|
|
190
219
|
await client.logDidYouMeanClick();
|
|
191
220
|
expectMatchPayload(SearchPageEvents.didyoumeanClick);
|
|
192
221
|
});
|
|
193
222
|
|
|
223
|
+
it('should send proper payload for #makeDidyoumeanClick', async () => {
|
|
224
|
+
const built = client.makeDidYouMeanClick();
|
|
225
|
+
await built.log();
|
|
226
|
+
expectMatchPayload(SearchPageEvents.didyoumeanClick);
|
|
227
|
+
expectMatchDescription(built.description, SearchPageEvents.didyoumeanClick);
|
|
228
|
+
});
|
|
229
|
+
|
|
194
230
|
it('should send proper payload for #resultsSort', async () => {
|
|
195
231
|
await client.logResultsSort({resultsSortBy: 'date ascending'});
|
|
196
232
|
expectMatchPayload(SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});
|
|
197
233
|
});
|
|
198
234
|
|
|
235
|
+
it('should send proper payload for #makeResultsSort', async () => {
|
|
236
|
+
const built = client.makeResultsSort({resultsSortBy: 'date ascending'});
|
|
237
|
+
await built.log();
|
|
238
|
+
expectMatchPayload(SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});
|
|
239
|
+
expectMatchDescription(built.description, SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});
|
|
240
|
+
});
|
|
241
|
+
|
|
199
242
|
it('should send proper payload for #searchboxSubmit', async () => {
|
|
200
243
|
await client.logSearchboxSubmit();
|
|
201
244
|
expectMatchPayload(SearchPageEvents.searchboxSubmit);
|
|
202
245
|
});
|
|
203
246
|
|
|
247
|
+
it('should send proper payload for #makeSearchboxSubmit', async () => {
|
|
248
|
+
const built = client.makeSearchboxSubmit();
|
|
249
|
+
await built.log();
|
|
250
|
+
expectMatchPayload(SearchPageEvents.searchboxSubmit);
|
|
251
|
+
expectMatchDescription(built.description, SearchPageEvents.searchboxSubmit);
|
|
252
|
+
});
|
|
253
|
+
|
|
204
254
|
it('should send proper payload for #searchboxClear', async () => {
|
|
205
255
|
await client.logSearchboxClear();
|
|
206
256
|
expectMatchPayload(SearchPageEvents.searchboxClear);
|
|
207
257
|
});
|
|
208
258
|
|
|
259
|
+
it('should send proper payload for #makeSearchboxClear', async () => {
|
|
260
|
+
const built = client.makeSearchboxClear();
|
|
261
|
+
await built.log();
|
|
262
|
+
expectMatchPayload(SearchPageEvents.searchboxClear);
|
|
263
|
+
expectMatchDescription(built.description, SearchPageEvents.searchboxClear);
|
|
264
|
+
});
|
|
265
|
+
|
|
209
266
|
it('should send proper payload for #searchboxAsYouType', async () => {
|
|
210
267
|
await client.logSearchboxAsYouType();
|
|
211
268
|
expectMatchPayload(SearchPageEvents.searchboxAsYouType);
|
|
212
269
|
});
|
|
213
270
|
|
|
214
|
-
it('should send proper payload for #
|
|
215
|
-
|
|
216
|
-
|
|
271
|
+
it('should send proper payload for #makeSearchboxAsYouType', async () => {
|
|
272
|
+
const built = client.makeSearchboxAsYouType();
|
|
273
|
+
await built.log();
|
|
274
|
+
expectMatchPayload(SearchPageEvents.searchboxAsYouType);
|
|
275
|
+
expectMatchDescription(built.description, SearchPageEvents.searchboxAsYouType);
|
|
217
276
|
});
|
|
218
277
|
|
|
219
278
|
it('should send proper payload for #documentQuickview', async () => {
|
|
@@ -221,21 +280,49 @@ describe('SearchPageClient', () => {
|
|
|
221
280
|
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, fakeDocID);
|
|
222
281
|
});
|
|
223
282
|
|
|
283
|
+
it('should send proper payload for #makeDocumentQuickview', async () => {
|
|
284
|
+
const built = client.makeDocumentQuickview(fakeDocInfo, fakeDocID);
|
|
285
|
+
await built.log();
|
|
286
|
+
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, fakeDocID);
|
|
287
|
+
expectMatchDescription(built.description, SearchPageEvents.documentQuickview, {...fakeDocID});
|
|
288
|
+
});
|
|
289
|
+
|
|
224
290
|
it('should send proper payload for #documentOpen', async () => {
|
|
225
291
|
await client.logDocumentOpen(fakeDocInfo, fakeDocID);
|
|
226
292
|
expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);
|
|
227
293
|
});
|
|
228
294
|
|
|
295
|
+
it('should send proper payload for #makeDocumentOpen', async () => {
|
|
296
|
+
const built = client.makeDocumentOpen(fakeDocInfo, fakeDocID);
|
|
297
|
+
await built.log();
|
|
298
|
+
expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);
|
|
299
|
+
expectMatchDescription(built.description, SearchPageEvents.documentOpen, {...fakeDocID});
|
|
300
|
+
});
|
|
301
|
+
|
|
229
302
|
it('should send proper payload for #showMoreFoldedResults', async () => {
|
|
230
303
|
await client.logShowMoreFoldedResults(fakeDocInfo, fakeDocID);
|
|
231
304
|
expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);
|
|
232
305
|
});
|
|
233
306
|
|
|
307
|
+
it('should send proper payload for #makeShowMoreFoldedResults', async () => {
|
|
308
|
+
const built = client.makeShowMoreFoldedResults(fakeDocInfo, fakeDocID);
|
|
309
|
+
await built.log();
|
|
310
|
+
expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);
|
|
311
|
+
expectMatchDescription(built.description, SearchPageEvents.showMoreFoldedResults, fakeDocID);
|
|
312
|
+
});
|
|
313
|
+
|
|
234
314
|
it('should send proper payload for #showLessFoldedResults', async () => {
|
|
235
315
|
await client.logShowLessFoldedResults();
|
|
236
316
|
expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);
|
|
237
317
|
});
|
|
238
318
|
|
|
319
|
+
it('should send proper payload for #makeShowLessFoldedResults', async () => {
|
|
320
|
+
const built = client.makeShowLessFoldedResults();
|
|
321
|
+
await built.log();
|
|
322
|
+
expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);
|
|
323
|
+
expectMatchDescription(built.description, SearchPageEvents.showLessFoldedResults);
|
|
324
|
+
});
|
|
325
|
+
|
|
239
326
|
it('should send proper payload for #omniboxAnalytics', async () => {
|
|
240
327
|
const meta: OmniboxSuggestionsMetadata = {
|
|
241
328
|
partialQueries: 'a;b;c',
|
|
@@ -248,6 +335,20 @@ describe('SearchPageClient', () => {
|
|
|
248
335
|
expectMatchPayload(SearchPageEvents.omniboxAnalytics, meta);
|
|
249
336
|
});
|
|
250
337
|
|
|
338
|
+
it('should send proper payload for #makeOmniboxAnalytics', async () => {
|
|
339
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
340
|
+
partialQueries: 'a;b;c',
|
|
341
|
+
partialQuery: 'abcd',
|
|
342
|
+
suggestionRanking: 1,
|
|
343
|
+
suggestions: 'q;w;e;r;t;y',
|
|
344
|
+
querySuggestResponseId: '1',
|
|
345
|
+
};
|
|
346
|
+
const built = client.makeOmniboxAnalytics(meta);
|
|
347
|
+
await built.log();
|
|
348
|
+
expectMatchPayload(SearchPageEvents.omniboxAnalytics, meta);
|
|
349
|
+
expectMatchDescription(built.description, SearchPageEvents.omniboxAnalytics, meta);
|
|
350
|
+
});
|
|
351
|
+
|
|
251
352
|
it('should send proper payload for #logOmniboxFromLink', async () => {
|
|
252
353
|
const meta: OmniboxSuggestionsMetadata = {
|
|
253
354
|
partialQueries: 'a;b;c',
|
|
@@ -260,11 +361,32 @@ describe('SearchPageClient', () => {
|
|
|
260
361
|
expectMatchPayload(SearchPageEvents.omniboxFromLink, meta);
|
|
261
362
|
});
|
|
262
363
|
|
|
364
|
+
it('should send proper payload for #makeOmniboxFromLink', async () => {
|
|
365
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
366
|
+
partialQueries: 'a;b;c',
|
|
367
|
+
partialQuery: 'abcd',
|
|
368
|
+
suggestionRanking: 1,
|
|
369
|
+
suggestions: 'q;w;e;r;t;y',
|
|
370
|
+
querySuggestResponseId: '1',
|
|
371
|
+
};
|
|
372
|
+
const built = client.makeOmniboxFromLink(meta);
|
|
373
|
+
await built.log();
|
|
374
|
+
expectMatchPayload(SearchPageEvents.omniboxFromLink, meta);
|
|
375
|
+
expectMatchDescription(built.description, SearchPageEvents.omniboxFromLink, meta);
|
|
376
|
+
});
|
|
377
|
+
|
|
263
378
|
it('should send proper payload for #logSearchFromLink', async () => {
|
|
264
379
|
await client.logSearchFromLink();
|
|
265
380
|
expectMatchPayload(SearchPageEvents.searchFromLink);
|
|
266
381
|
});
|
|
267
382
|
|
|
383
|
+
it('should send proper payload for #makeSearchFromLink', async () => {
|
|
384
|
+
const built = client.makeSearchFromLink();
|
|
385
|
+
await built.log();
|
|
386
|
+
expectMatchPayload(SearchPageEvents.searchFromLink);
|
|
387
|
+
expectMatchDescription(built.description, SearchPageEvents.searchFromLink);
|
|
388
|
+
});
|
|
389
|
+
|
|
268
390
|
it('should send proper payload for #logTriggerNotify', async () => {
|
|
269
391
|
const meta = {
|
|
270
392
|
notification: 'foo',
|
|
@@ -273,6 +395,16 @@ describe('SearchPageClient', () => {
|
|
|
273
395
|
expectMatchCustomEventPayload(SearchPageEvents.triggerNotify, meta);
|
|
274
396
|
});
|
|
275
397
|
|
|
398
|
+
it('should send proper payload for #makeTriggerNotify', async () => {
|
|
399
|
+
const meta = {
|
|
400
|
+
notification: 'foo',
|
|
401
|
+
};
|
|
402
|
+
const built = client.makeTriggerNotify(meta);
|
|
403
|
+
await built.log();
|
|
404
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerNotify, meta);
|
|
405
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerNotify, meta);
|
|
406
|
+
});
|
|
407
|
+
|
|
276
408
|
it('should send proper payload for #logTriggerExecute', async () => {
|
|
277
409
|
const meta = {
|
|
278
410
|
executed: 'foo',
|
|
@@ -281,6 +413,16 @@ describe('SearchPageClient', () => {
|
|
|
281
413
|
expectMatchCustomEventPayload(SearchPageEvents.triggerExecute, meta);
|
|
282
414
|
});
|
|
283
415
|
|
|
416
|
+
it('should send proper payload for #makeTriggerExecute', async () => {
|
|
417
|
+
const meta = {
|
|
418
|
+
executed: 'foo',
|
|
419
|
+
};
|
|
420
|
+
const built = client.makeTriggerExecute(meta);
|
|
421
|
+
await built.log();
|
|
422
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerExecute, meta);
|
|
423
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerExecute, meta);
|
|
424
|
+
});
|
|
425
|
+
|
|
284
426
|
it('should send proper payload for #logTriggerQuery', async () => {
|
|
285
427
|
const meta = {
|
|
286
428
|
query: 'queryText',
|
|
@@ -289,6 +431,16 @@ describe('SearchPageClient', () => {
|
|
|
289
431
|
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
290
432
|
});
|
|
291
433
|
|
|
434
|
+
it('should send proper payload for #makeTriggerQuery', async () => {
|
|
435
|
+
const meta = {
|
|
436
|
+
query: 'queryText',
|
|
437
|
+
};
|
|
438
|
+
const built = client.makeTriggerQuery();
|
|
439
|
+
await built.log();
|
|
440
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
441
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerQuery, meta);
|
|
442
|
+
});
|
|
443
|
+
|
|
292
444
|
it('should send proper payload for #logUndoTriggerQuery', async () => {
|
|
293
445
|
const meta = {
|
|
294
446
|
undoneQuery: 'foo',
|
|
@@ -297,6 +449,16 @@ describe('SearchPageClient', () => {
|
|
|
297
449
|
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
298
450
|
});
|
|
299
451
|
|
|
452
|
+
it('should send proper payload for #makeUndoTriggerQuery', async () => {
|
|
453
|
+
const meta = {
|
|
454
|
+
undoneQuery: 'foo',
|
|
455
|
+
};
|
|
456
|
+
const built = client.makeUndoTriggerQuery(meta);
|
|
457
|
+
await built.log();
|
|
458
|
+
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
459
|
+
expectMatchDescription(built.description, SearchPageEvents.undoTriggerQuery, meta);
|
|
460
|
+
});
|
|
461
|
+
|
|
300
462
|
it('should send proper payload for #logTriggerRedirect', async () => {
|
|
301
463
|
const meta = {
|
|
302
464
|
redirectedTo: 'foo',
|
|
@@ -305,6 +467,16 @@ describe('SearchPageClient', () => {
|
|
|
305
467
|
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
306
468
|
});
|
|
307
469
|
|
|
470
|
+
it('should send proper payload for #makeTriggerRedirect', async () => {
|
|
471
|
+
const meta = {
|
|
472
|
+
redirectedTo: 'foo',
|
|
473
|
+
};
|
|
474
|
+
const built = client.makeTriggerRedirect(meta);
|
|
475
|
+
await built.log();
|
|
476
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
477
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerRedirect, meta);
|
|
478
|
+
});
|
|
479
|
+
|
|
308
480
|
it('should send proper payload for #logPagerResize', async () => {
|
|
309
481
|
const meta = {
|
|
310
482
|
currentResultsPerPage: 123,
|
|
@@ -313,29 +485,70 @@ describe('SearchPageClient', () => {
|
|
|
313
485
|
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
314
486
|
});
|
|
315
487
|
|
|
488
|
+
it('should send proper payload for #makePagerResize', async () => {
|
|
489
|
+
const meta = {
|
|
490
|
+
currentResultsPerPage: 123,
|
|
491
|
+
};
|
|
492
|
+
const built = client.makePagerResize(meta);
|
|
493
|
+
await built.log();
|
|
494
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
495
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerResize, meta);
|
|
496
|
+
});
|
|
497
|
+
|
|
316
498
|
it('should send proper payload for #logPagerNumber', async () => {
|
|
317
499
|
const meta = {pagerNumber: 123};
|
|
318
500
|
await client.logPagerNumber(meta);
|
|
319
501
|
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
320
502
|
});
|
|
321
503
|
|
|
504
|
+
it('should send proper payload for #makePagerNumber', async () => {
|
|
505
|
+
const meta = {pagerNumber: 123};
|
|
506
|
+
const built = client.makePagerNumber(meta);
|
|
507
|
+
await built.log();
|
|
508
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
509
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerNumber, meta);
|
|
510
|
+
});
|
|
511
|
+
|
|
322
512
|
it('should send proper payload for #logPagerNext', async () => {
|
|
323
513
|
const meta = {pagerNumber: 123};
|
|
324
514
|
await client.logPagerNext(meta);
|
|
325
515
|
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
326
516
|
});
|
|
327
517
|
|
|
518
|
+
it('should send proper payload for #makePagerNext', async () => {
|
|
519
|
+
const meta = {pagerNumber: 123};
|
|
520
|
+
const built = client.makePagerNext(meta);
|
|
521
|
+
await built.log();
|
|
522
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
523
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerNext, meta);
|
|
524
|
+
});
|
|
525
|
+
|
|
328
526
|
it('should send proper payload for #logPagerPrevious', async () => {
|
|
329
527
|
const meta = {pagerNumber: 123};
|
|
330
528
|
await client.logPagerPrevious(meta);
|
|
331
529
|
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
332
530
|
});
|
|
333
531
|
|
|
532
|
+
it('should send proper payload for #makePagerPrevious', async () => {
|
|
533
|
+
const meta = {pagerNumber: 123};
|
|
534
|
+
const built = client.makePagerPrevious(meta);
|
|
535
|
+
await built.log();
|
|
536
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
537
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerPrevious, meta);
|
|
538
|
+
});
|
|
539
|
+
|
|
334
540
|
it('should send proper payload for #logPagerScrolling', async () => {
|
|
335
541
|
await client.logPagerScrolling();
|
|
336
542
|
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
337
543
|
});
|
|
338
544
|
|
|
545
|
+
it('should send proper payload for #makePagerScrolling', async () => {
|
|
546
|
+
const built = client.makePagerScrolling();
|
|
547
|
+
await built.log();
|
|
548
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
549
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);
|
|
550
|
+
});
|
|
551
|
+
|
|
339
552
|
it('should send the proper payload for #logStaticFilterClearAll', async () => {
|
|
340
553
|
const staticFilterId = 'filetypes';
|
|
341
554
|
await client.logStaticFilterClearAll({staticFilterId});
|
|
@@ -343,6 +556,14 @@ describe('SearchPageClient', () => {
|
|
|
343
556
|
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
344
557
|
});
|
|
345
558
|
|
|
559
|
+
it('should send the proper payload for #makeStaticFilterClearAll', async () => {
|
|
560
|
+
const staticFilterId = 'filetypes';
|
|
561
|
+
const built = client.makeStaticFilterClearAll({staticFilterId});
|
|
562
|
+
await built.log();
|
|
563
|
+
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
564
|
+
expectMatchDescription(built.description, SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
565
|
+
});
|
|
566
|
+
|
|
346
567
|
it('should send the proper payload for #logStaticFilterSelect', async () => {
|
|
347
568
|
const meta: StaticFilterToggleValueMetadata = {
|
|
348
569
|
staticFilterId: 'filetypes',
|
|
@@ -356,6 +577,21 @@ describe('SearchPageClient', () => {
|
|
|
356
577
|
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
357
578
|
});
|
|
358
579
|
|
|
580
|
+
it('should send the proper payload for #makeStaticFilterSelect', async () => {
|
|
581
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
582
|
+
staticFilterId: 'filetypes',
|
|
583
|
+
staticFilterValue: {
|
|
584
|
+
caption: 'Youtube',
|
|
585
|
+
expression: '@filetype="youtubevideo"',
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
const built = client.makeStaticFilterSelect(meta);
|
|
589
|
+
await built.log();
|
|
590
|
+
|
|
591
|
+
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
592
|
+
expectMatchDescription(built.description, SearchPageEvents.staticFilterSelect, meta);
|
|
593
|
+
});
|
|
594
|
+
|
|
359
595
|
it('should send the proper payload for #logStaticFilterDeselect', async () => {
|
|
360
596
|
const meta: StaticFilterToggleValueMetadata = {
|
|
361
597
|
staticFilterId: 'filetypes',
|
|
@@ -369,6 +605,20 @@ describe('SearchPageClient', () => {
|
|
|
369
605
|
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
370
606
|
});
|
|
371
607
|
|
|
608
|
+
it('should send the proper payload for #makeStaticFilterDeselect', async () => {
|
|
609
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
610
|
+
staticFilterId: 'filetypes',
|
|
611
|
+
staticFilterValue: {
|
|
612
|
+
caption: 'Youtube',
|
|
613
|
+
expression: '@filetype="youtubevideo"',
|
|
614
|
+
},
|
|
615
|
+
};
|
|
616
|
+
const built = client.makeStaticFilterDeselect(meta);
|
|
617
|
+
await built.log();
|
|
618
|
+
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
619
|
+
expectMatchDescription(built.description, SearchPageEvents.staticFilterDeselect, meta);
|
|
620
|
+
});
|
|
621
|
+
|
|
372
622
|
it('should send proper payload for #logFacetSearch', async () => {
|
|
373
623
|
const meta = {
|
|
374
624
|
facetField: '@foo',
|
|
@@ -379,6 +629,18 @@ describe('SearchPageClient', () => {
|
|
|
379
629
|
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
380
630
|
});
|
|
381
631
|
|
|
632
|
+
it('should send proper payload for #makeFacetSearch', async () => {
|
|
633
|
+
const meta = {
|
|
634
|
+
facetField: '@foo',
|
|
635
|
+
facetId: 'bar',
|
|
636
|
+
facetTitle: 'title',
|
|
637
|
+
};
|
|
638
|
+
const built = client.makeFacetSearch(meta);
|
|
639
|
+
await built.log();
|
|
640
|
+
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
641
|
+
expectMatchDescription(built.description, SearchPageEvents.facetSearch, meta);
|
|
642
|
+
});
|
|
643
|
+
|
|
382
644
|
it('should send proper payload for #logFacetSelect', async () => {
|
|
383
645
|
const meta = {
|
|
384
646
|
facetField: '@foo',
|
|
@@ -391,6 +653,19 @@ describe('SearchPageClient', () => {
|
|
|
391
653
|
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
392
654
|
});
|
|
393
655
|
|
|
656
|
+
it('should send proper payload for #makeFacetSelect', async () => {
|
|
657
|
+
const meta = {
|
|
658
|
+
facetField: '@foo',
|
|
659
|
+
facetId: 'bar',
|
|
660
|
+
facetTitle: 'title',
|
|
661
|
+
facetValue: 'qwerty',
|
|
662
|
+
};
|
|
663
|
+
const built = await client.makeFacetSelect(meta);
|
|
664
|
+
await built.log();
|
|
665
|
+
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
666
|
+
expectMatchDescription(built.description, SearchPageEvents.facetSelect, meta);
|
|
667
|
+
});
|
|
668
|
+
|
|
394
669
|
it('should send proper payload for #logFacetDeselect', async () => {
|
|
395
670
|
const meta = {
|
|
396
671
|
facetField: '@foo',
|
|
@@ -403,6 +678,20 @@ describe('SearchPageClient', () => {
|
|
|
403
678
|
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
404
679
|
});
|
|
405
680
|
|
|
681
|
+
it('should send proper payload for #makeFacetDeselect', async () => {
|
|
682
|
+
const meta = {
|
|
683
|
+
facetField: '@foo',
|
|
684
|
+
facetId: 'bar',
|
|
685
|
+
facetTitle: 'title',
|
|
686
|
+
facetValue: 'qwerty',
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
const built = client.makeFacetDeselect(meta);
|
|
690
|
+
await built.log();
|
|
691
|
+
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
692
|
+
expectMatchDescription(built.description, SearchPageEvents.facetDeselect, meta);
|
|
693
|
+
});
|
|
694
|
+
|
|
406
695
|
it('should send proper payload for #logFacetExclude', async () => {
|
|
407
696
|
const meta = {
|
|
408
697
|
facetField: '@foo',
|
|
@@ -414,6 +703,19 @@ describe('SearchPageClient', () => {
|
|
|
414
703
|
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
415
704
|
});
|
|
416
705
|
|
|
706
|
+
it('should send proper payload for #makeFacetExclude', async () => {
|
|
707
|
+
const meta = {
|
|
708
|
+
facetField: '@foo',
|
|
709
|
+
facetId: 'bar',
|
|
710
|
+
facetTitle: 'title',
|
|
711
|
+
facetValue: 'qwerty',
|
|
712
|
+
};
|
|
713
|
+
const built = client.makeFacetExclude(meta);
|
|
714
|
+
await built.log();
|
|
715
|
+
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
716
|
+
expectMatchDescription(built.description, SearchPageEvents.facetExclude, meta);
|
|
717
|
+
});
|
|
718
|
+
|
|
417
719
|
it('should send proper payload for #logFacetUnexclude', async () => {
|
|
418
720
|
const meta = {
|
|
419
721
|
facetField: '@foo',
|
|
@@ -425,6 +727,19 @@ describe('SearchPageClient', () => {
|
|
|
425
727
|
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
426
728
|
});
|
|
427
729
|
|
|
730
|
+
it('should send proper payload for #makeFacetUnexclude', async () => {
|
|
731
|
+
const meta = {
|
|
732
|
+
facetField: '@foo',
|
|
733
|
+
facetId: 'bar',
|
|
734
|
+
facetTitle: 'title',
|
|
735
|
+
facetValue: 'qwerty',
|
|
736
|
+
};
|
|
737
|
+
const built = client.makeFacetUnexclude(meta);
|
|
738
|
+
await built.log();
|
|
739
|
+
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
740
|
+
expectMatchDescription(built.description, SearchPageEvents.facetUnexclude, meta);
|
|
741
|
+
});
|
|
742
|
+
|
|
428
743
|
it('should send proper payload for #logFacetSelectAll', async () => {
|
|
429
744
|
const meta = {
|
|
430
745
|
facetField: '@foo',
|
|
@@ -435,6 +750,18 @@ describe('SearchPageClient', () => {
|
|
|
435
750
|
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
436
751
|
});
|
|
437
752
|
|
|
753
|
+
it('should send proper payload for #makeFacetSelectAll', async () => {
|
|
754
|
+
const meta = {
|
|
755
|
+
facetField: '@foo',
|
|
756
|
+
facetId: 'bar',
|
|
757
|
+
facetTitle: 'title',
|
|
758
|
+
};
|
|
759
|
+
const built = client.makeFacetSelectAll(meta);
|
|
760
|
+
await built.log();
|
|
761
|
+
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
762
|
+
expectMatchDescription(built.description, SearchPageEvents.facetSelectAll, meta);
|
|
763
|
+
});
|
|
764
|
+
|
|
438
765
|
it('should send proper payload for #logFacetUpdateSort', async () => {
|
|
439
766
|
const meta = {
|
|
440
767
|
facetField: '@foo',
|
|
@@ -446,6 +773,19 @@ describe('SearchPageClient', () => {
|
|
|
446
773
|
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
447
774
|
});
|
|
448
775
|
|
|
776
|
+
it('should send proper payload for #makeFacetUpdateSort', async () => {
|
|
777
|
+
const meta = {
|
|
778
|
+
facetField: '@foo',
|
|
779
|
+
facetId: 'bar',
|
|
780
|
+
facetTitle: 'title',
|
|
781
|
+
criteria: 'bazz',
|
|
782
|
+
};
|
|
783
|
+
const built = client.makeFacetUpdateSort(meta);
|
|
784
|
+
await built.log();
|
|
785
|
+
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
786
|
+
expectMatchDescription(built.description, SearchPageEvents.facetUpdateSort, meta);
|
|
787
|
+
});
|
|
788
|
+
|
|
449
789
|
it('should send proper payload for #logFacetShowMore', async () => {
|
|
450
790
|
const meta = {
|
|
451
791
|
facetField: '@foo',
|
|
@@ -456,6 +796,18 @@ describe('SearchPageClient', () => {
|
|
|
456
796
|
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
457
797
|
});
|
|
458
798
|
|
|
799
|
+
it('should send proper payload for #makeFacetShowMore', async () => {
|
|
800
|
+
const meta = {
|
|
801
|
+
facetField: '@foo',
|
|
802
|
+
facetId: 'bar',
|
|
803
|
+
facetTitle: 'title',
|
|
804
|
+
};
|
|
805
|
+
const built = client.makeFacetShowMore(meta);
|
|
806
|
+
await built.log();
|
|
807
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
808
|
+
expectMatchDescription(built.description, SearchPageEvents.facetShowMore, meta);
|
|
809
|
+
});
|
|
810
|
+
|
|
459
811
|
it('should send proper payload for #logFacetShowLess', async () => {
|
|
460
812
|
const meta = {
|
|
461
813
|
facetField: '@foo',
|
|
@@ -466,6 +818,18 @@ describe('SearchPageClient', () => {
|
|
|
466
818
|
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
467
819
|
});
|
|
468
820
|
|
|
821
|
+
it('should send proper payload for #makeFacetShowLess', async () => {
|
|
822
|
+
const meta = {
|
|
823
|
+
facetField: '@foo',
|
|
824
|
+
facetId: 'bar',
|
|
825
|
+
facetTitle: 'title',
|
|
826
|
+
};
|
|
827
|
+
const built = client.makeFacetShowLess(meta);
|
|
828
|
+
await built.log();
|
|
829
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
830
|
+
expectMatchDescription(built.description, SearchPageEvents.facetShowLess, meta);
|
|
831
|
+
});
|
|
832
|
+
|
|
469
833
|
it('should send proper payload for #logQueryError', async () => {
|
|
470
834
|
const meta = {
|
|
471
835
|
query: 'q',
|
|
@@ -479,71 +843,177 @@ describe('SearchPageClient', () => {
|
|
|
479
843
|
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
480
844
|
});
|
|
481
845
|
|
|
846
|
+
it('should send proper payload for #makeQueryError', async () => {
|
|
847
|
+
const meta = {
|
|
848
|
+
query: 'q',
|
|
849
|
+
aq: 'aq',
|
|
850
|
+
cq: 'cq',
|
|
851
|
+
dq: 'dq',
|
|
852
|
+
errorMessage: 'boom',
|
|
853
|
+
errorType: 'a bad one',
|
|
854
|
+
};
|
|
855
|
+
const built = client.makeQueryError(meta);
|
|
856
|
+
await built.log();
|
|
857
|
+
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
858
|
+
expectMatchDescription(built.description, SearchPageEvents.queryError, meta);
|
|
859
|
+
});
|
|
860
|
+
|
|
482
861
|
it('should send proper payload for #logQueryErrorBack', async () => {
|
|
483
862
|
await client.logQueryErrorBack();
|
|
484
863
|
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
485
864
|
});
|
|
486
865
|
|
|
866
|
+
it('should send proper payload for #makeQueryErrorBack', async () => {
|
|
867
|
+
const built = client.makeQueryErrorBack();
|
|
868
|
+
await built.log();
|
|
869
|
+
|
|
870
|
+
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
871
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorBack);
|
|
872
|
+
});
|
|
873
|
+
|
|
487
874
|
it('should send proper payload for #logQueryErrorRetry', async () => {
|
|
488
875
|
await client.logQueryErrorRetry();
|
|
489
876
|
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
490
877
|
});
|
|
491
878
|
|
|
879
|
+
it('should send proper payload for #makeQueryErrorRetry', async () => {
|
|
880
|
+
const built = client.makeQueryErrorRetry();
|
|
881
|
+
await built.log();
|
|
882
|
+
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
883
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorRetry);
|
|
884
|
+
});
|
|
885
|
+
|
|
492
886
|
it('should send proper payload for #logQueryErrorClear', async () => {
|
|
493
887
|
await client.logQueryErrorClear();
|
|
494
888
|
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
495
889
|
});
|
|
496
890
|
|
|
891
|
+
it('should send proper payload for #makeQueryErrorClear', async () => {
|
|
892
|
+
const built = client.makeQueryErrorClear();
|
|
893
|
+
await built.log();
|
|
894
|
+
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
895
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorClear);
|
|
896
|
+
});
|
|
897
|
+
|
|
497
898
|
it('should send proper payload for #logRecommendationInterfaceLoad', async () => {
|
|
498
899
|
await client.logRecommendationInterfaceLoad();
|
|
499
900
|
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
500
901
|
});
|
|
501
902
|
|
|
903
|
+
it('should send proper payload for #makeRecommendationInterfaceLoad', async () => {
|
|
904
|
+
const built = client.makeRecommendationInterfaceLoad();
|
|
905
|
+
await built.log();
|
|
906
|
+
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
907
|
+
expectMatchDescription(built.description, SearchPageEvents.recommendationInterfaceLoad);
|
|
908
|
+
});
|
|
909
|
+
|
|
502
910
|
it('should send proper payload for #logRecommendation', async () => {
|
|
503
911
|
await client.logRecommendation();
|
|
504
912
|
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
505
913
|
});
|
|
506
914
|
|
|
915
|
+
it('should send proper payload for #makeRecommendation', async () => {
|
|
916
|
+
const built = client.makeRecommendation();
|
|
917
|
+
await built.log();
|
|
918
|
+
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
919
|
+
});
|
|
920
|
+
|
|
507
921
|
it('should send proper payload for #recommendationOpen', async () => {
|
|
508
922
|
await client.logRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
509
923
|
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
510
924
|
});
|
|
511
925
|
|
|
926
|
+
it('should send proper payload for #makeRecommendationOpen', async () => {
|
|
927
|
+
const built = client.makeRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
928
|
+
await built.log();
|
|
929
|
+
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
930
|
+
expectMatchDescription(built.description, SearchPageEvents.recommendationOpen, {...fakeDocID});
|
|
931
|
+
});
|
|
932
|
+
|
|
512
933
|
it('should send proper payload for #fetchMoreResults', async () => {
|
|
513
934
|
await client.logFetchMoreResults();
|
|
514
935
|
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
515
936
|
});
|
|
516
937
|
|
|
938
|
+
it('should send proper payload for #makeFetchMoreResults', async () => {
|
|
939
|
+
const built = client.makeFetchMoreResults();
|
|
940
|
+
await built.log();
|
|
941
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
942
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);
|
|
943
|
+
});
|
|
944
|
+
|
|
517
945
|
it('should send proper payload for #logLikeSmartSnippet', async () => {
|
|
518
946
|
await client.logLikeSmartSnippet();
|
|
519
947
|
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
520
948
|
});
|
|
521
949
|
|
|
950
|
+
it('should send proper payload for #makeLikeSmartSnippet', async () => {
|
|
951
|
+
const built = client.makeLikeSmartSnippet();
|
|
952
|
+
await built.log();
|
|
953
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
954
|
+
expectMatchDescription(built.description, SearchPageEvents.likeSmartSnippet);
|
|
955
|
+
});
|
|
956
|
+
|
|
522
957
|
it('should send proper payload for #logDislikeSmartSnippet', async () => {
|
|
523
958
|
await client.logDislikeSmartSnippet();
|
|
524
959
|
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
525
960
|
});
|
|
526
961
|
|
|
962
|
+
it('should send proper payload for #makeDislikeSmartSnippet', async () => {
|
|
963
|
+
const built = client.makeDislikeSmartSnippet();
|
|
964
|
+
await built.log();
|
|
965
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
966
|
+
expectMatchDescription(built.description, SearchPageEvents.dislikeSmartSnippet);
|
|
967
|
+
});
|
|
968
|
+
|
|
527
969
|
it('should send proper payload for #logExpandSmartSnippet', async () => {
|
|
528
970
|
await client.logExpandSmartSnippet();
|
|
529
971
|
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
530
972
|
});
|
|
531
973
|
|
|
974
|
+
it('should send proper payload for #makeExpandSmartSnippet', async () => {
|
|
975
|
+
const built = client.makeExpandSmartSnippet();
|
|
976
|
+
await built.log();
|
|
977
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
978
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippet);
|
|
979
|
+
});
|
|
980
|
+
|
|
532
981
|
it('should send proper payload for #logCollapseSmartSnippet', async () => {
|
|
533
982
|
await client.logCollapseSmartSnippet();
|
|
534
983
|
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
535
984
|
});
|
|
536
985
|
|
|
986
|
+
it('should send proper payload for #makeCollapseSmartSnippet', async () => {
|
|
987
|
+
const built = client.makeCollapseSmartSnippet();
|
|
988
|
+
await built.log();
|
|
989
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
990
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippet);
|
|
991
|
+
});
|
|
992
|
+
|
|
537
993
|
it('should send proper payload for #logOpenSmartSnippetFeedbackModal', async () => {
|
|
538
994
|
await client.logOpenSmartSnippetFeedbackModal();
|
|
539
995
|
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
540
996
|
});
|
|
541
997
|
|
|
998
|
+
it('should send proper payload for #makeOpenSmartSnippetFeedbackModal', async () => {
|
|
999
|
+
const built = client.makeOpenSmartSnippetFeedbackModal();
|
|
1000
|
+
await built.log();
|
|
1001
|
+
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1002
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1003
|
+
});
|
|
1004
|
+
|
|
542
1005
|
it('should send proper payload for #logCloseSmartSnippetFeedbackModal', async () => {
|
|
543
1006
|
await client.logCloseSmartSnippetFeedbackModal();
|
|
544
1007
|
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
545
1008
|
});
|
|
546
1009
|
|
|
1010
|
+
it('should send proper payload for #makeCloseSmartSnippetFeedbackModal', async () => {
|
|
1011
|
+
const built = client.makeCloseSmartSnippetFeedbackModal();
|
|
1012
|
+
await built.log();
|
|
1013
|
+
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1014
|
+
expectMatchDescription(built.description, SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1015
|
+
});
|
|
1016
|
+
|
|
547
1017
|
it('should send proper payload for #logSmartSnippetFeedbackReason', async () => {
|
|
548
1018
|
await client.logSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
|
|
549
1019
|
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
@@ -552,6 +1022,19 @@ describe('SearchPageClient', () => {
|
|
|
552
1022
|
});
|
|
553
1023
|
});
|
|
554
1024
|
|
|
1025
|
+
it('should send proper payload for #makeSmartSnippetFeedbackReason', async () => {
|
|
1026
|
+
const built = client.makeSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
|
|
1027
|
+
await built.log();
|
|
1028
|
+
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
1029
|
+
details: 'this is irrelevant',
|
|
1030
|
+
reason: 'does_not_answer',
|
|
1031
|
+
});
|
|
1032
|
+
expectMatchDescription(built.description, SearchPageEvents.sendSmartSnippetReason, {
|
|
1033
|
+
details: 'this is irrelevant',
|
|
1034
|
+
reason: 'does_not_answer',
|
|
1035
|
+
});
|
|
1036
|
+
});
|
|
1037
|
+
|
|
555
1038
|
it('should send proper payload for #logExpandSmartSnippetSuggestion', async () => {
|
|
556
1039
|
await client.logExpandSmartSnippetSuggestion({
|
|
557
1040
|
question: 'Abc',
|
|
@@ -565,6 +1048,25 @@ describe('SearchPageClient', () => {
|
|
|
565
1048
|
});
|
|
566
1049
|
});
|
|
567
1050
|
|
|
1051
|
+
it('should send proper payload for #makeExpandSmartSnippetSuggestion', async () => {
|
|
1052
|
+
const built = client.makeExpandSmartSnippetSuggestion({
|
|
1053
|
+
question: 'Abc',
|
|
1054
|
+
answerSnippet: 'Def',
|
|
1055
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1056
|
+
});
|
|
1057
|
+
await built.log();
|
|
1058
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1059
|
+
question: 'Abc',
|
|
1060
|
+
answerSnippet: 'Def',
|
|
1061
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1062
|
+
});
|
|
1063
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1064
|
+
question: 'Abc',
|
|
1065
|
+
answerSnippet: 'Def',
|
|
1066
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
|
|
568
1070
|
it('should send proper payload for #logCollapseSmartSnippetSuggestion', async () => {
|
|
569
1071
|
await client.logCollapseSmartSnippetSuggestion({
|
|
570
1072
|
question: 'Abc',
|
|
@@ -578,6 +1080,25 @@ describe('SearchPageClient', () => {
|
|
|
578
1080
|
});
|
|
579
1081
|
});
|
|
580
1082
|
|
|
1083
|
+
it('should send proper payload for #makeCollapseSmartSnippetSuggestion', async () => {
|
|
1084
|
+
const built = client.makeCollapseSmartSnippetSuggestion({
|
|
1085
|
+
question: 'Abc',
|
|
1086
|
+
answerSnippet: 'Def',
|
|
1087
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1088
|
+
});
|
|
1089
|
+
await built.log();
|
|
1090
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1091
|
+
question: 'Abc',
|
|
1092
|
+
answerSnippet: 'Def',
|
|
1093
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1094
|
+
});
|
|
1095
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1096
|
+
question: 'Abc',
|
|
1097
|
+
answerSnippet: 'Def',
|
|
1098
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
|
|
581
1102
|
it('should send proper payload for #logExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
582
1103
|
await client.logExpandSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
|
|
583
1104
|
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
@@ -585,6 +1106,20 @@ describe('SearchPageClient', () => {
|
|
|
585
1106
|
});
|
|
586
1107
|
});
|
|
587
1108
|
|
|
1109
|
+
it('should send proper payload for #makeExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1110
|
+
const built = client.makeExpandSmartSnippetSuggestion({
|
|
1111
|
+
contentIdKey: 'permanentid',
|
|
1112
|
+
contentIdValue: 'foo',
|
|
1113
|
+
});
|
|
1114
|
+
await built.log();
|
|
1115
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1116
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1117
|
+
});
|
|
1118
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1119
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
1122
|
+
|
|
588
1123
|
it('should send proper payload for #logCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
589
1124
|
await client.logCollapseSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
|
|
590
1125
|
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
@@ -592,6 +1127,17 @@ describe('SearchPageClient', () => {
|
|
|
592
1127
|
});
|
|
593
1128
|
});
|
|
594
1129
|
|
|
1130
|
+
it('should send proper payload for #makeCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1131
|
+
const built = client.makeCollapseSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
|
|
1132
|
+
await built.log();
|
|
1133
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1134
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1135
|
+
});
|
|
1136
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1137
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
|
|
595
1141
|
it('should send proper payload for #logShowMoreSmartSnippetSuggestion', async () => {
|
|
596
1142
|
await client.logShowMoreSmartSnippetSuggestion({
|
|
597
1143
|
question: 'Abc',
|
|
@@ -601,7 +1147,6 @@ describe('SearchPageClient', () => {
|
|
|
601
1147
|
expectMatchCustomEventPayload(SearchPageEvents.showMoreSmartSnippetSuggestion, {
|
|
602
1148
|
question: 'Abc',
|
|
603
1149
|
answerSnippet: 'Def',
|
|
604
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
605
1150
|
});
|
|
606
1151
|
});
|
|
607
1152
|
|
|
@@ -623,6 +1168,13 @@ describe('SearchPageClient', () => {
|
|
|
623
1168
|
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
624
1169
|
});
|
|
625
1170
|
|
|
1171
|
+
it('should send proper payload for #makeOpenSmartSnippetSource', async () => {
|
|
1172
|
+
const built = client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
1173
|
+
await built.log();
|
|
1174
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
1175
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSource, {...fakeDocID});
|
|
1176
|
+
});
|
|
1177
|
+
|
|
626
1178
|
it('should send proper payload for #logOpenSmartSnippetSuggestionSource', async () => {
|
|
627
1179
|
const meta = {
|
|
628
1180
|
question: 'Abc',
|
|
@@ -637,6 +1189,18 @@ describe('SearchPageClient', () => {
|
|
|
637
1189
|
});
|
|
638
1190
|
});
|
|
639
1191
|
|
|
1192
|
+
it('should send proper payload for #makeOpenSmartSnippetSuggestionSource', async () => {
|
|
1193
|
+
const meta = {
|
|
1194
|
+
question: 'Abc',
|
|
1195
|
+
answerSnippet: 'Def',
|
|
1196
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1197
|
+
};
|
|
1198
|
+
const built = client.makeOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
|
|
1199
|
+
await built.log();
|
|
1200
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionSource, fakeDocInfo, meta);
|
|
1201
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionSource, meta);
|
|
1202
|
+
});
|
|
1203
|
+
|
|
640
1204
|
it('should send proper payload for #logOpenSmartSnippetInlineLink', async () => {
|
|
641
1205
|
const meta = {
|
|
642
1206
|
...fakeDocID,
|
|
@@ -647,6 +1211,18 @@ describe('SearchPageClient', () => {
|
|
|
647
1211
|
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
648
1212
|
});
|
|
649
1213
|
|
|
1214
|
+
it('should send proper payload for #makeOpenSmartSnippetInlineLink', async () => {
|
|
1215
|
+
const meta = {
|
|
1216
|
+
...fakeDocID,
|
|
1217
|
+
linkText: 'Some text',
|
|
1218
|
+
linkURL: 'https://invalid.com',
|
|
1219
|
+
};
|
|
1220
|
+
const built = client.makeOpenSmartSnippetInlineLink(fakeDocInfo, meta);
|
|
1221
|
+
await built.log();
|
|
1222
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
1223
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetInlineLink, meta);
|
|
1224
|
+
});
|
|
1225
|
+
|
|
650
1226
|
it('should send proper payload for #logOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
651
1227
|
const meta = {
|
|
652
1228
|
question: 'Abc',
|
|
@@ -663,16 +1239,46 @@ describe('SearchPageClient', () => {
|
|
|
663
1239
|
});
|
|
664
1240
|
});
|
|
665
1241
|
|
|
1242
|
+
it('should send proper payload for #makeOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
1243
|
+
const meta = {
|
|
1244
|
+
question: 'Abc',
|
|
1245
|
+
answerSnippet: 'Def',
|
|
1246
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1247
|
+
linkText: 'Some text',
|
|
1248
|
+
linkURL: 'https://invalid.com',
|
|
1249
|
+
};
|
|
1250
|
+
const built = client.makeOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
|
|
1251
|
+
await built.log();
|
|
1252
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, meta);
|
|
1253
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionInlineLink, meta);
|
|
1254
|
+
});
|
|
1255
|
+
|
|
666
1256
|
it('should send proper payload for #logRecentQueryClick', async () => {
|
|
667
1257
|
await client.logRecentQueryClick();
|
|
668
1258
|
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
669
1259
|
});
|
|
670
1260
|
|
|
1261
|
+
it('should send proper payload for #makeRecentQueryClick', async () => {
|
|
1262
|
+
const built = client.makeRecentQueryClick();
|
|
1263
|
+
await built.log();
|
|
1264
|
+
|
|
1265
|
+
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
1266
|
+
expectMatchDescription(built.description, SearchPageEvents.recentQueryClick);
|
|
1267
|
+
});
|
|
1268
|
+
|
|
671
1269
|
it('should send proper payload for #logClearRecentQueries', async () => {
|
|
672
1270
|
await client.logClearRecentQueries();
|
|
673
1271
|
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
674
1272
|
});
|
|
675
1273
|
|
|
1274
|
+
it('should send proper payload for #makeClearRecentQueries', async () => {
|
|
1275
|
+
const built = client.makeClearRecentQueries();
|
|
1276
|
+
await built.log();
|
|
1277
|
+
|
|
1278
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
1279
|
+
expectMatchDescription(built.description, SearchPageEvents.clearRecentQueries);
|
|
1280
|
+
});
|
|
1281
|
+
|
|
676
1282
|
it('should send proper payload for #logRecentResultClick', async () => {
|
|
677
1283
|
await client.logRecentResultClick(fakeDocInfo, fakeDocID);
|
|
678
1284
|
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
@@ -681,21 +1287,60 @@ describe('SearchPageClient', () => {
|
|
|
681
1287
|
});
|
|
682
1288
|
});
|
|
683
1289
|
|
|
1290
|
+
it('should send proper payload for #makeRecentResultClick', async () => {
|
|
1291
|
+
const built = client.makeRecentResultClick(fakeDocInfo, fakeDocID);
|
|
1292
|
+
await built.log();
|
|
1293
|
+
|
|
1294
|
+
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
1295
|
+
info: fakeDocInfo,
|
|
1296
|
+
identifier: fakeDocID,
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
expectMatchDescription(built.description, SearchPageEvents.recentResultClick, {
|
|
1300
|
+
info: fakeDocInfo,
|
|
1301
|
+
identifier: fakeDocID,
|
|
1302
|
+
});
|
|
1303
|
+
});
|
|
1304
|
+
|
|
684
1305
|
it('should send proper payload for #logNoResultsBack', async () => {
|
|
685
1306
|
await client.logNoResultsBack();
|
|
686
1307
|
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
687
1308
|
});
|
|
688
1309
|
|
|
1310
|
+
it('should send proper payload for #makeNoResultsBack', async () => {
|
|
1311
|
+
const built = client.makeNoResultsBack();
|
|
1312
|
+
await built.log();
|
|
1313
|
+
|
|
1314
|
+
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
1315
|
+
expectMatchDescription(built.description, SearchPageEvents.noResultsBack);
|
|
1316
|
+
});
|
|
1317
|
+
|
|
689
1318
|
it('should send proper payload for #logClearRecentResults', async () => {
|
|
690
1319
|
await client.logClearRecentResults();
|
|
691
1320
|
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
692
1321
|
});
|
|
693
1322
|
|
|
1323
|
+
it('should send proper payload for #makeClearRecentResults', async () => {
|
|
1324
|
+
const built = client.makeClearRecentResults();
|
|
1325
|
+
await built.log();
|
|
1326
|
+
|
|
1327
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
1328
|
+
expectMatchDescription(built.description, SearchPageEvents.clearRecentResults);
|
|
1329
|
+
});
|
|
1330
|
+
|
|
694
1331
|
it('should send proper payload for #logCustomEventWithType', async () => {
|
|
695
1332
|
await client.logCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
|
|
696
1333
|
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
697
1334
|
});
|
|
698
1335
|
|
|
1336
|
+
it('should send proper payload for #makeCustomEventWithType', async () => {
|
|
1337
|
+
const built = client.makeCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
|
|
1338
|
+
await built.log();
|
|
1339
|
+
|
|
1340
|
+
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
1341
|
+
expectMatchDescription(built.description, 'foo' as SearchPageEvents, {buzz: 'bazz'});
|
|
1342
|
+
});
|
|
1343
|
+
|
|
699
1344
|
it('should enable analytics tracking by default', () => {
|
|
700
1345
|
const c = new CoveoSearchPageClient({}, provider);
|
|
701
1346
|
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|