@internetarchive/collection-browser 1.5.3-alpha.0 → 1.6.0
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.
|
@@ -3,13 +3,19 @@ import { SearchServiceErrorType } from '@internetarchive/search-service/dist/src
|
|
|
3
3
|
export const getMockSuccessSingleResult = () => ({
|
|
4
4
|
success: {
|
|
5
5
|
request: {
|
|
6
|
+
kind: 'hits',
|
|
6
7
|
clientParameters: {
|
|
7
8
|
user_query: 'collection:foo',
|
|
8
9
|
sort: [],
|
|
9
10
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
backendRequests: {
|
|
12
|
+
primary: {
|
|
13
|
+
kind: 'hits',
|
|
14
|
+
finalized_parameters: {
|
|
15
|
+
user_query: 'collection:foo',
|
|
16
|
+
sort: [],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
13
19
|
},
|
|
14
20
|
},
|
|
15
21
|
rawResponse: {},
|
|
@@ -34,13 +40,19 @@ export const getMockSuccessSingleResult = () => ({
|
|
|
34
40
|
export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
35
41
|
success: {
|
|
36
42
|
request: {
|
|
43
|
+
kind: 'hits',
|
|
37
44
|
clientParameters: {
|
|
38
45
|
user_query: 'years',
|
|
39
46
|
sort: [],
|
|
40
47
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
backendRequests: {
|
|
49
|
+
primary: {
|
|
50
|
+
kind: 'hits',
|
|
51
|
+
finalized_parameters: {
|
|
52
|
+
user_query: 'years',
|
|
53
|
+
sort: [],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
44
56
|
},
|
|
45
57
|
},
|
|
46
58
|
rawResponse: {},
|
|
@@ -75,13 +87,19 @@ export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
|
75
87
|
export const getMockSuccessLoggedInResult = () => ({
|
|
76
88
|
success: {
|
|
77
89
|
request: {
|
|
90
|
+
kind: 'hits',
|
|
78
91
|
clientParameters: {
|
|
79
92
|
user_query: 'loggedin',
|
|
80
93
|
sort: [],
|
|
81
94
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
backendRequests: {
|
|
96
|
+
primary: {
|
|
97
|
+
kind: 'hits',
|
|
98
|
+
finalized_parameters: {
|
|
99
|
+
user_query: 'loggedin',
|
|
100
|
+
sort: [],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
85
103
|
},
|
|
86
104
|
},
|
|
87
105
|
rawResponse: {},
|
|
@@ -108,13 +126,19 @@ export const getMockSuccessLoggedInResult = () => ({
|
|
|
108
126
|
export const getMockSuccessNoPreviewResult = () => ({
|
|
109
127
|
success: {
|
|
110
128
|
request: {
|
|
129
|
+
kind: 'hits',
|
|
111
130
|
clientParameters: {
|
|
112
131
|
user_query: 'no-preview',
|
|
113
132
|
sort: [],
|
|
114
133
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
backendRequests: {
|
|
135
|
+
primary: {
|
|
136
|
+
kind: 'hits',
|
|
137
|
+
finalized_parameters: {
|
|
138
|
+
user_query: 'no-preview',
|
|
139
|
+
sort: [],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
118
142
|
},
|
|
119
143
|
},
|
|
120
144
|
rawResponse: {},
|
|
@@ -139,13 +163,19 @@ export const getMockSuccessNoPreviewResult = () => ({
|
|
|
139
163
|
export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
|
|
140
164
|
success: {
|
|
141
165
|
request: {
|
|
166
|
+
kind: 'hits',
|
|
142
167
|
clientParameters: {
|
|
143
168
|
user_query: 'loggedin-no-preview',
|
|
144
169
|
sort: [],
|
|
145
170
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
171
|
+
backendRequests: {
|
|
172
|
+
primary: {
|
|
173
|
+
kind: 'hits',
|
|
174
|
+
finalized_parameters: {
|
|
175
|
+
user_query: 'loggedin-no-preview',
|
|
176
|
+
sort: [],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
149
179
|
},
|
|
150
180
|
},
|
|
151
181
|
rawResponse: {},
|
|
@@ -170,13 +200,19 @@ export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
|
|
|
170
200
|
export const getMockSuccessFirstTitleResult = () => ({
|
|
171
201
|
success: {
|
|
172
202
|
request: {
|
|
203
|
+
kind: 'hits',
|
|
173
204
|
clientParameters: {
|
|
174
205
|
user_query: 'first-title',
|
|
175
206
|
sort: ['title', 'asc'],
|
|
176
207
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
208
|
+
backendRequests: {
|
|
209
|
+
primary: {
|
|
210
|
+
kind: 'hits',
|
|
211
|
+
finalized_parameters: {
|
|
212
|
+
user_query: 'first-title',
|
|
213
|
+
sort: ['title', 'asc'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
180
216
|
},
|
|
181
217
|
},
|
|
182
218
|
rawResponse: {},
|
|
@@ -205,13 +241,19 @@ export const getMockSuccessFirstTitleResult = () => ({
|
|
|
205
241
|
export const getMockSuccessFirstCreatorResult = () => ({
|
|
206
242
|
success: {
|
|
207
243
|
request: {
|
|
244
|
+
kind: 'hits',
|
|
208
245
|
clientParameters: {
|
|
209
246
|
user_query: 'first-creator',
|
|
210
247
|
sort: ['creator', 'asc'],
|
|
211
248
|
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
249
|
+
backendRequests: {
|
|
250
|
+
primary: {
|
|
251
|
+
kind: 'hits',
|
|
252
|
+
finalized_parameters: {
|
|
253
|
+
user_query: 'first-creator',
|
|
254
|
+
sort: ['creator', 'asc'],
|
|
255
|
+
},
|
|
256
|
+
},
|
|
215
257
|
},
|
|
216
258
|
},
|
|
217
259
|
rawResponse: {},
|
|
@@ -240,13 +282,19 @@ export const getMockSuccessFirstCreatorResult = () => ({
|
|
|
240
282
|
export const getMockSuccessWithCollectionTitles = () => ({
|
|
241
283
|
success: {
|
|
242
284
|
request: {
|
|
285
|
+
kind: 'hits',
|
|
243
286
|
clientParameters: {
|
|
244
287
|
user_query: 'collection:foo',
|
|
245
288
|
sort: [],
|
|
246
289
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
290
|
+
backendRequests: {
|
|
291
|
+
primary: {
|
|
292
|
+
kind: 'hits',
|
|
293
|
+
finalized_parameters: {
|
|
294
|
+
user_query: 'collection:foo',
|
|
295
|
+
sort: [],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
250
298
|
},
|
|
251
299
|
},
|
|
252
300
|
rawResponse: {},
|
|
@@ -283,13 +331,19 @@ export const getMockSuccessWithCollectionTitles = () => ({
|
|
|
283
331
|
export const getMockSuccessWithCollectionAggregations = () => ({
|
|
284
332
|
success: {
|
|
285
333
|
request: {
|
|
334
|
+
kind: 'hits',
|
|
286
335
|
clientParameters: {
|
|
287
336
|
user_query: 'collection:foo',
|
|
288
337
|
sort: [],
|
|
289
338
|
},
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
339
|
+
backendRequests: {
|
|
340
|
+
primary: {
|
|
341
|
+
kind: 'hits',
|
|
342
|
+
finalized_parameters: {
|
|
343
|
+
user_query: 'collection:foo',
|
|
344
|
+
sort: [],
|
|
345
|
+
},
|
|
346
|
+
},
|
|
293
347
|
},
|
|
294
348
|
},
|
|
295
349
|
rawResponse: {},
|
|
@@ -321,13 +375,19 @@ export const getMockSuccessWithCollectionAggregations = () => ({
|
|
|
321
375
|
export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
|
|
322
376
|
success: {
|
|
323
377
|
request: {
|
|
378
|
+
kind: 'hits',
|
|
324
379
|
clientParameters: {
|
|
325
380
|
user_query: 'with-sort',
|
|
326
381
|
sort: ['foo:asc'],
|
|
327
382
|
},
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
383
|
+
backendRequests: {
|
|
384
|
+
primary: {
|
|
385
|
+
kind: 'hits',
|
|
386
|
+
finalized_parameters: {
|
|
387
|
+
user_query: 'with-sort',
|
|
388
|
+
sort: ['foo:asc'],
|
|
389
|
+
},
|
|
390
|
+
},
|
|
331
391
|
},
|
|
332
392
|
},
|
|
333
393
|
rawResponse: {},
|
|
@@ -355,13 +415,19 @@ export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
|
|
|
355
415
|
export const getMockSuccessMultipleResults = () => ({
|
|
356
416
|
success: {
|
|
357
417
|
request: {
|
|
418
|
+
kind: 'hits',
|
|
358
419
|
clientParameters: {
|
|
359
420
|
user_query: 'collection:foo',
|
|
360
421
|
sort: [],
|
|
361
422
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
423
|
+
backendRequests: {
|
|
424
|
+
primary: {
|
|
425
|
+
kind: 'hits',
|
|
426
|
+
finalized_parameters: {
|
|
427
|
+
user_query: 'collection:foo',
|
|
428
|
+
sort: [],
|
|
429
|
+
},
|
|
430
|
+
},
|
|
365
431
|
},
|
|
366
432
|
},
|
|
367
433
|
rawResponse: {},
|
|
@@ -392,13 +458,19 @@ export const getMockSuccessMultipleResults = () => ({
|
|
|
392
458
|
export const getMockSuccessMultiLineDescription = () => ({
|
|
393
459
|
success: {
|
|
394
460
|
request: {
|
|
461
|
+
kind: 'hits',
|
|
395
462
|
clientParameters: {
|
|
396
463
|
user_query: 'multi-line-description',
|
|
397
464
|
sort: [],
|
|
398
465
|
},
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
466
|
+
backendRequests: {
|
|
467
|
+
primary: {
|
|
468
|
+
kind: 'hits',
|
|
469
|
+
finalized_parameters: {
|
|
470
|
+
user_query: 'multi-line-description',
|
|
471
|
+
sort: [],
|
|
472
|
+
},
|
|
473
|
+
},
|
|
402
474
|
},
|
|
403
475
|
},
|
|
404
476
|
rawResponse: {},
|
|
@@ -424,13 +496,19 @@ export const getMockSuccessMultiLineDescription = () => ({
|
|
|
424
496
|
export const getMockSuccessExtraQuotedHref = () => ({
|
|
425
497
|
success: {
|
|
426
498
|
request: {
|
|
499
|
+
kind: 'hits',
|
|
427
500
|
clientParameters: {
|
|
428
501
|
user_query: 'extra-quoted-href',
|
|
429
502
|
sort: [],
|
|
430
503
|
},
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
504
|
+
backendRequests: {
|
|
505
|
+
primary: {
|
|
506
|
+
kind: 'hits',
|
|
507
|
+
finalized_parameters: {
|
|
508
|
+
user_query: 'extra-quoted-href',
|
|
509
|
+
sort: [],
|
|
510
|
+
},
|
|
511
|
+
},
|
|
434
512
|
},
|
|
435
513
|
},
|
|
436
514
|
rawResponse: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-search-responses.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-responses.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,OAAO,EAEP,kBAAkB,EAClB,OAAO,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AAEvG,MAAM,CAAC,MAAM,0BAA0B,GAGnC,GAAG,EAAE,CAAC,CAAC;IACT,OAAO,EAAE;QACP,OAAO,EAAE;YACP,gBAAgB,EAAE;gBAChB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE,EAAE;aACT;YACD,mBAAmB,EAAE;gBACnB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE,EAAE;aACT;SACF;QACD,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE;YACR,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;YAChB,OAAO,EAAE;gBACP,IAAI,OAAO,CAAC;oBACV,MAAM,EAAE;wBACN,UAAU,EAAE,KAAK;wBACjB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;qBAC3B;iBACF,CAAC;aACH;SACF;QACD,cAAc,EAAE;YACd,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,CAAC;SACd;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mCAAmC,G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AAM,CAAC,MAAM,sBAAsB,GAG/B,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport {\n Aggregation,\n ItemHit,\n SearchResponse,\n SearchServiceError,\n TextHit,\n} from '@internetarchive/search-service';\nimport { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';\n\nexport const getMockSuccessSingleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithYearHistogramAggs: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'years',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'years',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n subject: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 3,\n },\n ],\n }),\n year_histogram: new Aggregation({\n buckets: [1, 2, 3, 3, 2, 1],\n first_bucket_key: 1950,\n last_bucket_key: 2000,\n interval: 10,\n number_buckets: 6,\n }),\n },\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'loggedin',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'loggedin',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'bar'],\n title: 'foo',\n mediatype: 'data',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'no-preview',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'no-preview',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInAndNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstTitleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n finalizedParameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstTitle: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstCreatorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n finalizedParameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstCreator: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionTitles: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n collectionTitles: {\n foo: 'Foo Collection',\n bar: 'Bar Collection',\n baz: 'Baz Collection',\n boop: 'Boop Collection',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionAggregations: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n aggregations: {\n collection: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 10,\n },\n {\n key: 'bar',\n doc_count: 10,\n },\n ],\n }),\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessSingleResultWithSort: (\n resultsSpy: Function\n) => Result<SearchResponse, SearchServiceError> = (resultsSpy: Function) => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n finalizedParameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n get results() {\n resultsSpy();\n return [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ];\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultipleResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultiLineDescription: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n description: ['line1', 'line2'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessExtraQuotedHref: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n clientParameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n finalizedParameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new TextHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n __href__: '/details/foo?q=%22%22quoted+query%22%22',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockErrorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {\n message: 'bar',\n }),\n});\n\nexport const getMockMalformedResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({});\n"]}
|
|
1
|
+
{"version":3,"file":"mock-search-responses.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-responses.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,OAAO,EAEP,kBAAkB,EAClB,OAAO,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AAEvG,MAAM,CAAC,MAAM,0BAA0B,GAGnC,GAAG,EAAE,CAAC,CAAC;IACT,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,gBAAgB,EAAE;gBAChB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE,EAAE;aACT;YACD,eAAe,EAAE;gBACf,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,oBAAoB,EAAE;wBACpB,UAAU,EAAE,gBAAgB;wBAC5B,IAAI,EAAE,EAAE;qBACT;iBACF;aACF;SACF;QACD,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE;YACR,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;YAChB,OAAO,EAAE;gBACP,IAAI,OAAO,CAAC;oBACV,MAAM,EAAE;wBACN,UAAU,EAAE,KAAK;wBACjB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;qBAC3B;iBACF,CAAC;aACH;SACF;QACD,cAAc,EAAE;YACd,SAAS,EAAE,IAAI;YACf,UAAU,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C;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAG/B,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport {\n Aggregation,\n ItemHit,\n SearchResponse,\n SearchServiceError,\n TextHit,\n} from '@internetarchive/search-service';\nimport { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';\n\nexport const getMockSuccessSingleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithYearHistogramAggs: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'years',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'years',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n subject: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 3,\n },\n ],\n }),\n year_histogram: new Aggregation({\n buckets: [1, 2, 3, 3, 2, 1],\n first_bucket_key: 1950,\n last_bucket_key: 2000,\n interval: 10,\n number_buckets: 6,\n }),\n },\n results: [],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'bar'],\n title: 'foo',\n mediatype: 'data',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessLoggedInAndNoPreviewResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'loggedin-no-preview',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'loggedin', 'no-preview', 'bar'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstTitleResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-title',\n sort: ['title', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstTitle: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessFirstCreatorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'first-creator',\n sort: ['creator', 'asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n aggregations: {\n firstCreator: new Aggregation({\n buckets: [{ key: 'X', doc_count: 1 }],\n }),\n },\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionTitles: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n collectionTitles: {\n foo: 'Foo Collection',\n bar: 'Bar Collection',\n baz: 'Baz Collection',\n boop: 'Boop Collection',\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithCollectionAggregations: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\n aggregations: {\n collection: new Aggregation({\n buckets: [\n {\n key: 'foo',\n doc_count: 10,\n },\n {\n key: 'bar',\n doc_count: 10,\n },\n ],\n }),\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessSingleResultWithSort: (\n resultsSpy: Function\n) => Result<SearchResponse, SearchServiceError> = (resultsSpy: Function) => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'with-sort',\n sort: ['foo:asc'],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n get results() {\n resultsSpy();\n return [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n ];\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultipleResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'collection:foo',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 2,\n returnedCount: 2,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessMultiLineDescription: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'multi-line-description',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new ItemHit({\n fields: {\n identifier: 'foo',\n collection: ['foo', 'bar'],\n description: ['line1', 'line2'],\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessExtraQuotedHref: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'extra-quoted-href',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new TextHit({\n fields: {\n identifier: 'foo',\n title: 'Foo',\n __href__: '/details/foo?q=%22%22quoted+query%22%22',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockErrorResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {\n message: 'bar',\n }),\n});\n\nexport const getMockMalformedResult: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({});\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "The Internet Archive Collection Browser.",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"author": "Internet Archive",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.6.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@internetarchive/analytics-manager": "^0.1.2",
|
|
26
|
-
"@internetarchive/collection-name-cache": "^0.2.
|
|
26
|
+
"@internetarchive/collection-name-cache": "^0.2.12",
|
|
27
27
|
"@internetarchive/feature-feedback": "^0.1.4",
|
|
28
28
|
"@internetarchive/field-parsers": "^0.1.3",
|
|
29
29
|
"@internetarchive/histogram-date-range": "^1.1.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@internetarchive/infinite-scroller": "^0.1.4",
|
|
33
33
|
"@internetarchive/local-cache": "^0.2.1",
|
|
34
34
|
"@internetarchive/modal-manager": "^0.2.8",
|
|
35
|
-
"@internetarchive/search-service": "^1.
|
|
35
|
+
"@internetarchive/search-service": "^1.1.0",
|
|
36
36
|
"@internetarchive/shared-resize-observer": "^0.2.0",
|
|
37
37
|
"@lit/localize": "^0.11.2",
|
|
38
38
|
"dompurify": "^2.3.6",
|
|
@@ -14,13 +14,19 @@ export const getMockSuccessSingleResult: () => Result<
|
|
|
14
14
|
> = () => ({
|
|
15
15
|
success: {
|
|
16
16
|
request: {
|
|
17
|
+
kind: 'hits',
|
|
17
18
|
clientParameters: {
|
|
18
19
|
user_query: 'collection:foo',
|
|
19
20
|
sort: [],
|
|
20
21
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
backendRequests: {
|
|
23
|
+
primary: {
|
|
24
|
+
kind: 'hits',
|
|
25
|
+
finalized_parameters: {
|
|
26
|
+
user_query: 'collection:foo',
|
|
27
|
+
sort: [],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
24
30
|
},
|
|
25
31
|
},
|
|
26
32
|
rawResponse: {},
|
|
@@ -49,13 +55,19 @@ export const getMockSuccessWithYearHistogramAggs: () => Result<
|
|
|
49
55
|
> = () => ({
|
|
50
56
|
success: {
|
|
51
57
|
request: {
|
|
58
|
+
kind: 'hits',
|
|
52
59
|
clientParameters: {
|
|
53
60
|
user_query: 'years',
|
|
54
61
|
sort: [],
|
|
55
62
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
backendRequests: {
|
|
64
|
+
primary: {
|
|
65
|
+
kind: 'hits',
|
|
66
|
+
finalized_parameters: {
|
|
67
|
+
user_query: 'years',
|
|
68
|
+
sort: [],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
59
71
|
},
|
|
60
72
|
},
|
|
61
73
|
rawResponse: {},
|
|
@@ -94,13 +106,19 @@ export const getMockSuccessLoggedInResult: () => Result<
|
|
|
94
106
|
> = () => ({
|
|
95
107
|
success: {
|
|
96
108
|
request: {
|
|
109
|
+
kind: 'hits',
|
|
97
110
|
clientParameters: {
|
|
98
111
|
user_query: 'loggedin',
|
|
99
112
|
sort: [],
|
|
100
113
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
backendRequests: {
|
|
115
|
+
primary: {
|
|
116
|
+
kind: 'hits',
|
|
117
|
+
finalized_parameters: {
|
|
118
|
+
user_query: 'loggedin',
|
|
119
|
+
sort: [],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
104
122
|
},
|
|
105
123
|
},
|
|
106
124
|
rawResponse: {},
|
|
@@ -131,13 +149,19 @@ export const getMockSuccessNoPreviewResult: () => Result<
|
|
|
131
149
|
> = () => ({
|
|
132
150
|
success: {
|
|
133
151
|
request: {
|
|
152
|
+
kind: 'hits',
|
|
134
153
|
clientParameters: {
|
|
135
154
|
user_query: 'no-preview',
|
|
136
155
|
sort: [],
|
|
137
156
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
backendRequests: {
|
|
158
|
+
primary: {
|
|
159
|
+
kind: 'hits',
|
|
160
|
+
finalized_parameters: {
|
|
161
|
+
user_query: 'no-preview',
|
|
162
|
+
sort: [],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
141
165
|
},
|
|
142
166
|
},
|
|
143
167
|
rawResponse: {},
|
|
@@ -166,13 +190,19 @@ export const getMockSuccessLoggedInAndNoPreviewResult: () => Result<
|
|
|
166
190
|
> = () => ({
|
|
167
191
|
success: {
|
|
168
192
|
request: {
|
|
193
|
+
kind: 'hits',
|
|
169
194
|
clientParameters: {
|
|
170
195
|
user_query: 'loggedin-no-preview',
|
|
171
196
|
sort: [],
|
|
172
197
|
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
backendRequests: {
|
|
199
|
+
primary: {
|
|
200
|
+
kind: 'hits',
|
|
201
|
+
finalized_parameters: {
|
|
202
|
+
user_query: 'loggedin-no-preview',
|
|
203
|
+
sort: [],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
176
206
|
},
|
|
177
207
|
},
|
|
178
208
|
rawResponse: {},
|
|
@@ -201,13 +231,19 @@ export const getMockSuccessFirstTitleResult: () => Result<
|
|
|
201
231
|
> = () => ({
|
|
202
232
|
success: {
|
|
203
233
|
request: {
|
|
234
|
+
kind: 'hits',
|
|
204
235
|
clientParameters: {
|
|
205
236
|
user_query: 'first-title',
|
|
206
237
|
sort: ['title', 'asc'],
|
|
207
238
|
},
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
239
|
+
backendRequests: {
|
|
240
|
+
primary: {
|
|
241
|
+
kind: 'hits',
|
|
242
|
+
finalized_parameters: {
|
|
243
|
+
user_query: 'first-title',
|
|
244
|
+
sort: ['title', 'asc'],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
211
247
|
},
|
|
212
248
|
},
|
|
213
249
|
rawResponse: {},
|
|
@@ -240,13 +276,19 @@ export const getMockSuccessFirstCreatorResult: () => Result<
|
|
|
240
276
|
> = () => ({
|
|
241
277
|
success: {
|
|
242
278
|
request: {
|
|
279
|
+
kind: 'hits',
|
|
243
280
|
clientParameters: {
|
|
244
281
|
user_query: 'first-creator',
|
|
245
282
|
sort: ['creator', 'asc'],
|
|
246
283
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
284
|
+
backendRequests: {
|
|
285
|
+
primary: {
|
|
286
|
+
kind: 'hits',
|
|
287
|
+
finalized_parameters: {
|
|
288
|
+
user_query: 'first-creator',
|
|
289
|
+
sort: ['creator', 'asc'],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
250
292
|
},
|
|
251
293
|
},
|
|
252
294
|
rawResponse: {},
|
|
@@ -279,13 +321,19 @@ export const getMockSuccessWithCollectionTitles: () => Result<
|
|
|
279
321
|
> = () => ({
|
|
280
322
|
success: {
|
|
281
323
|
request: {
|
|
324
|
+
kind: 'hits',
|
|
282
325
|
clientParameters: {
|
|
283
326
|
user_query: 'collection:foo',
|
|
284
327
|
sort: [],
|
|
285
328
|
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
329
|
+
backendRequests: {
|
|
330
|
+
primary: {
|
|
331
|
+
kind: 'hits',
|
|
332
|
+
finalized_parameters: {
|
|
333
|
+
user_query: 'collection:foo',
|
|
334
|
+
sort: [],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
289
337
|
},
|
|
290
338
|
},
|
|
291
339
|
rawResponse: {},
|
|
@@ -326,13 +374,19 @@ export const getMockSuccessWithCollectionAggregations: () => Result<
|
|
|
326
374
|
> = () => ({
|
|
327
375
|
success: {
|
|
328
376
|
request: {
|
|
377
|
+
kind: 'hits',
|
|
329
378
|
clientParameters: {
|
|
330
379
|
user_query: 'collection:foo',
|
|
331
380
|
sort: [],
|
|
332
381
|
},
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
382
|
+
backendRequests: {
|
|
383
|
+
primary: {
|
|
384
|
+
kind: 'hits',
|
|
385
|
+
finalized_parameters: {
|
|
386
|
+
user_query: 'collection:foo',
|
|
387
|
+
sort: [],
|
|
388
|
+
},
|
|
389
|
+
},
|
|
336
390
|
},
|
|
337
391
|
},
|
|
338
392
|
rawResponse: {},
|
|
@@ -367,13 +421,19 @@ export const getMockSuccessSingleResultWithSort: (
|
|
|
367
421
|
) => Result<SearchResponse, SearchServiceError> = (resultsSpy: Function) => ({
|
|
368
422
|
success: {
|
|
369
423
|
request: {
|
|
424
|
+
kind: 'hits',
|
|
370
425
|
clientParameters: {
|
|
371
426
|
user_query: 'with-sort',
|
|
372
427
|
sort: ['foo:asc'],
|
|
373
428
|
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
429
|
+
backendRequests: {
|
|
430
|
+
primary: {
|
|
431
|
+
kind: 'hits',
|
|
432
|
+
finalized_parameters: {
|
|
433
|
+
user_query: 'with-sort',
|
|
434
|
+
sort: ['foo:asc'],
|
|
435
|
+
},
|
|
436
|
+
},
|
|
377
437
|
},
|
|
378
438
|
},
|
|
379
439
|
rawResponse: {},
|
|
@@ -405,13 +465,19 @@ export const getMockSuccessMultipleResults: () => Result<
|
|
|
405
465
|
> = () => ({
|
|
406
466
|
success: {
|
|
407
467
|
request: {
|
|
468
|
+
kind: 'hits',
|
|
408
469
|
clientParameters: {
|
|
409
470
|
user_query: 'collection:foo',
|
|
410
471
|
sort: [],
|
|
411
472
|
},
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
473
|
+
backendRequests: {
|
|
474
|
+
primary: {
|
|
475
|
+
kind: 'hits',
|
|
476
|
+
finalized_parameters: {
|
|
477
|
+
user_query: 'collection:foo',
|
|
478
|
+
sort: [],
|
|
479
|
+
},
|
|
480
|
+
},
|
|
415
481
|
},
|
|
416
482
|
},
|
|
417
483
|
rawResponse: {},
|
|
@@ -446,13 +512,19 @@ export const getMockSuccessMultiLineDescription: () => Result<
|
|
|
446
512
|
> = () => ({
|
|
447
513
|
success: {
|
|
448
514
|
request: {
|
|
515
|
+
kind: 'hits',
|
|
449
516
|
clientParameters: {
|
|
450
517
|
user_query: 'multi-line-description',
|
|
451
518
|
sort: [],
|
|
452
519
|
},
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
520
|
+
backendRequests: {
|
|
521
|
+
primary: {
|
|
522
|
+
kind: 'hits',
|
|
523
|
+
finalized_parameters: {
|
|
524
|
+
user_query: 'multi-line-description',
|
|
525
|
+
sort: [],
|
|
526
|
+
},
|
|
527
|
+
},
|
|
456
528
|
},
|
|
457
529
|
},
|
|
458
530
|
rawResponse: {},
|
|
@@ -482,13 +554,19 @@ export const getMockSuccessExtraQuotedHref: () => Result<
|
|
|
482
554
|
> = () => ({
|
|
483
555
|
success: {
|
|
484
556
|
request: {
|
|
557
|
+
kind: 'hits',
|
|
485
558
|
clientParameters: {
|
|
486
559
|
user_query: 'extra-quoted-href',
|
|
487
560
|
sort: [],
|
|
488
561
|
},
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
562
|
+
backendRequests: {
|
|
563
|
+
primary: {
|
|
564
|
+
kind: 'hits',
|
|
565
|
+
finalized_parameters: {
|
|
566
|
+
user_query: 'extra-quoted-href',
|
|
567
|
+
sort: [],
|
|
568
|
+
},
|
|
569
|
+
},
|
|
492
570
|
},
|
|
493
571
|
},
|
|
494
572
|
rawResponse: {},
|