@internetarchive/collection-browser 1.14.17 → 2.0.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.
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +0 -2
- package/dist/src/app-root.js +0 -8
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +49 -200
- package/dist/src/collection-browser.js +191 -762
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +2 -2
- package/dist/src/collection-facets/facet-row.js +5 -10
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/facets-template.d.ts +2 -2
- package/dist/src/collection-facets/facets-template.js +2 -2
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +2 -9
- package/dist/src/collection-facets/more-facets-content.js +13 -18
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets.d.ts +2 -3
- package/dist/src/collection-facets.js +12 -13
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +217 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
- package/dist/src/data-source/collection-browser-data-source.d.ts +352 -0
- package/dist/src/data-source/collection-browser-data-source.js +912 -0
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -0
- package/dist/src/data-source/collection-browser-query-state.d.ts +43 -0
- package/dist/src/data-source/collection-browser-query-state.js +2 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
- package/dist/src/data-source/models.d.ts +28 -0
- package/dist/src/data-source/models.js +9 -0
- package/dist/src/data-source/models.js.map +1 -0
- package/dist/src/manage/manage-bar.d.ts +1 -1
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.d.ts +21 -4
- package/dist/src/models.js +111 -0
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +26 -23
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +1 -0
- package/dist/src/tiles/grid/item-tile.js +28 -1
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +13 -8
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +2 -2
- package/dist/src/tiles/hover/hover-pane-controller.js +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +2 -2
- package/dist/src/tiles/hover/tile-hover-pane.js +2 -2
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +3 -0
- package/dist/src/tiles/item-image.js +30 -2
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +4 -3
- package/dist/src/tiles/list/tile-list.js +39 -14
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +2 -2
- package/dist/src/tiles/tile-dispatcher.js +5 -5
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.d.ts +6 -2
- package/dist/src/tiles/tile-display-value-provider.js +15 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -0
- package/dist/src/utils/collapse-repeated-quotes.js +14 -0
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -0
- package/dist/src/utils/log.d.ts +7 -0
- package/dist/src/utils/log.js +16 -0
- package/dist/src/utils/log.js.map +1 -0
- package/dist/src/utils/resolve-mediatype.d.ts +8 -0
- package/dist/src/utils/resolve-mediatype.js +24 -0
- package/dist/src/utils/resolve-mediatype.js.map +1 -0
- package/dist/test/collection-browser.test.js +142 -92
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +6 -17
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +2 -2
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +5 -5
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -0
- package/dist/test/data-source/collection-browser-data-source.test.js +80 -0
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -0
- package/dist/test/item-image.test.js +33 -34
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.d.ts +3 -0
- package/dist/test/mocks/mock-search-responses.js +131 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +4 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +41 -4
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +62 -0
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +44 -0
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +18 -17
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +44 -5
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +12 -0
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/index.ts +4 -1
- package/package.json +3 -4
- package/src/app-root.ts +0 -10
- package/src/collection-browser.ts +219 -935
- package/src/collection-facets/facet-row.ts +4 -9
- package/src/collection-facets/facets-template.ts +3 -3
- package/src/collection-facets/more-facets-content.ts +15 -20
- package/src/collection-facets.ts +11 -14
- package/src/data-source/collection-browser-data-source-interface.ts +272 -0
- package/src/data-source/collection-browser-data-source.ts +1166 -0
- package/src/data-source/collection-browser-query-state.ts +54 -0
- package/src/data-source/models.ts +38 -0
- package/src/manage/manage-bar.ts +1 -1
- package/src/models.ts +164 -3
- package/src/sort-filter-bar/sort-filter-bar.ts +26 -23
- package/src/tiles/grid/item-tile.ts +36 -1
- package/src/tiles/grid/tile-stats.ts +12 -7
- package/src/tiles/hover/hover-pane-controller.ts +3 -3
- package/src/tiles/hover/tile-hover-pane.ts +3 -3
- package/src/tiles/item-image.ts +28 -0
- package/src/tiles/list/tile-list.ts +56 -23
- package/src/tiles/tile-dispatcher.ts +5 -5
- package/src/tiles/tile-display-value-provider.ts +20 -2
- package/src/utils/collapse-repeated-quotes.ts +13 -0
- package/src/utils/log.ts +16 -0
- package/src/utils/resolve-mediatype.ts +26 -0
- package/test/collection-browser.test.ts +213 -106
- package/test/collection-facets/facet-row.test.ts +5 -18
- package/test/collection-facets/more-facets-content.test.ts +4 -2
- package/test/collection-facets.test.ts +5 -5
- package/test/data-source/collection-browser-data-source.test.ts +103 -0
- package/test/item-image.test.ts +34 -36
- package/test/mocks/mock-search-responses.ts +144 -0
- package/test/mocks/mock-search-service.ts +6 -0
- package/test/sort-filter-bar/sort-filter-bar.test.ts +50 -4
- package/test/tile-stats.test.ts +104 -0
- package/test/tiles/grid/item-tile.test.ts +55 -0
- package/test/tiles/hover/hover-pane-controller.test.ts +19 -17
- package/test/tiles/list/tile-list.test.ts +55 -5
- package/test/tiles/tile-dispatcher.test.ts +13 -0
- package/dist/test/mocks/mock-collection-name-cache.d.ts +0 -9
- package/dist/test/mocks/mock-collection-name-cache.js +0 -18
- package/dist/test/mocks/mock-collection-name-cache.js.map +0 -1
- package/test/mocks/mock-collection-name-cache.ts +0 -24
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
/* eslint-disable import/no-duplicates */
|
|
2
2
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
3
|
import { html } from 'lit';
|
|
4
|
+
import { TileModel } from '../src/models';
|
|
4
5
|
import '../src/tiles/item-image';
|
|
5
6
|
const baseImageUrl = 'https://archive.org';
|
|
6
|
-
const testBookModel = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
collectionSize: 0,
|
|
39
|
-
};
|
|
7
|
+
const testBookModel = new TileModel({});
|
|
8
|
+
testBookModel.checked = false;
|
|
9
|
+
testBookModel.collections = [];
|
|
10
|
+
testBookModel.commentCount = 0;
|
|
11
|
+
testBookModel.creators = [];
|
|
12
|
+
testBookModel.favCount = 0;
|
|
13
|
+
testBookModel.identifier = '18730130BloomfieldRecordCompleteIssue';
|
|
14
|
+
testBookModel.itemCount = 0;
|
|
15
|
+
testBookModel.mediatype = 'texts';
|
|
16
|
+
testBookModel.subjects = [];
|
|
17
|
+
testBookModel.title = 'Sample Waveform';
|
|
18
|
+
testBookModel.viewCount = 0;
|
|
19
|
+
testBookModel.loginRequired = false;
|
|
20
|
+
testBookModel.contentWarning = false;
|
|
21
|
+
testBookModel.collectionFilesCount = 0;
|
|
22
|
+
testBookModel.collectionSize = 0;
|
|
23
|
+
const testAudioModel = new TileModel({});
|
|
24
|
+
testAudioModel.checked = false;
|
|
25
|
+
testAudioModel.collections = [];
|
|
26
|
+
testAudioModel.commentCount = 0;
|
|
27
|
+
testAudioModel.creators = [];
|
|
28
|
+
testAudioModel.favCount = 0;
|
|
29
|
+
testAudioModel.identifier = 'dwd2015-01-24';
|
|
30
|
+
testAudioModel.itemCount = 0;
|
|
31
|
+
testAudioModel.mediatype = 'audio';
|
|
32
|
+
testAudioModel.subjects = [];
|
|
33
|
+
testAudioModel.title = 'Sample Waveform';
|
|
34
|
+
testAudioModel.viewCount = 0;
|
|
35
|
+
testAudioModel.loginRequired = false;
|
|
36
|
+
testAudioModel.contentWarning = false;
|
|
37
|
+
testAudioModel.collectionFilesCount = 0;
|
|
38
|
+
testAudioModel.collectionSize = 0;
|
|
40
39
|
describe('ItemImage component', () => {
|
|
41
40
|
it('should render initial component', async () => {
|
|
42
41
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-image.test.js","sourceRoot":"","sources":["../../test/item-image.test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"item-image.test.js","sourceRoot":"","sources":["../../test/item-image.test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,yBAAyB,CAAC;AAEjC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAC3C,MAAM,aAAa,GAAc,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC;AACnD,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;AAC9B,aAAa,CAAC,WAAW,GAAG,EAAE,CAAC;AAC/B,aAAa,CAAC,YAAY,GAAG,CAAC,CAAC;AAC/B,aAAa,CAAC,QAAQ,GAAG,EAAE,CAAC;AAC5B,aAAa,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC3B,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AC;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QACrB,MAAM,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport { expect, fixture } from '@open-wc/testing';\nimport { html } from 'lit';\n\nimport { TileModel } from '../src/models';\nimport type { ItemImage } from '../src/tiles/item-image';\n\nimport '../src/tiles/item-image';\n\nconst baseImageUrl = 'https://archive.org';\nconst testBookModel: TileModel = new TileModel({});\ntestBookModel.checked = false;\ntestBookModel.collections = [];\ntestBookModel.commentCount = 0;\ntestBookModel.creators = [];\ntestBookModel.favCount = 0;\ntestBookModel.identifier = '18730130BloomfieldRecordCompleteIssue';\ntestBookModel.itemCount = 0;\ntestBookModel.mediatype = 'texts';\ntestBookModel.subjects = [];\ntestBookModel.title = 'Sample Waveform';\ntestBookModel.viewCount = 0;\ntestBookModel.loginRequired = false;\ntestBookModel.contentWarning = false;\ntestBookModel.collectionFilesCount = 0;\ntestBookModel.collectionSize = 0;\n\nconst testAudioModel: TileModel = new TileModel({});\ntestAudioModel.checked = false;\ntestAudioModel.collections = [];\ntestAudioModel.commentCount = 0;\ntestAudioModel.creators = [];\ntestAudioModel.favCount = 0;\ntestAudioModel.identifier = 'dwd2015-01-24';\ntestAudioModel.itemCount = 0;\ntestAudioModel.mediatype = 'audio';\ntestAudioModel.subjects = [];\ntestAudioModel.title = 'Sample Waveform';\ntestAudioModel.viewCount = 0;\ntestAudioModel.loginRequired = false;\ntestAudioModel.contentWarning = false;\ntestAudioModel.collectionFilesCount = 0;\ntestAudioModel.collectionSize = 0;\n\ndescribe('ItemImage component', () => {\n it('should render initial component', async () => {\n const el = await fixture<ItemImage>(html`\n <item-image\n .isListTile=${false}\n .isCompactTile=${false}\n .model=${testBookModel}\n .baseImageUrl=${baseImageUrl}\n >\n </item-image>\n `);\n\n const dropShadow = el.shadowRoot?.querySelector('.drop-shadow');\n const imgClassName = dropShadow?.querySelector('img')?.className;\n\n expect(dropShadow).to.exist;\n expect(imgClassName).to.eql(' contain ');\n });\n\n it('should render component if mediatype is waveform', async () => {\n const el = await fixture<ItemImage>(html`\n <item-image\n .isListTile=${false}\n .isCompactTile=${false}\n .model=${testAudioModel}\n .baseImageUrl=${baseImageUrl}\n >\n </item-image>\n `);\n\n const dropShadow = el.shadowRoot?.querySelector('.drop-shadow');\n const image = dropShadow?.querySelector('img');\n expect(dropShadow).to.exist;\n expect(image).to.exist;\n\n // simulate image onLoad event check if image className is waveform\n setTimeout(() => {\n const imgClassName = image?.className;\n expect(imgClassName).to.eql(' waveform ');\n }, 1000);\n });\n\n it('should not fetch image with undefined base url', async () => {\n const el = await fixture<ItemImage>(html`\n <item-image\n .isListTile=${false}\n .isCompactTile=${false}\n .model=${testBookModel}\n >\n </item-image>\n `);\n\n // Doesn't set the image src if base url is undefined\n const img = el.shadowRoot?.querySelector('img');\n expect(img).to.exist;\n expect(img?.getAttribute('src')).not.to.exist;\n });\n\n it('should not fetch image with undefined model', async () => {\n const el = await fixture<ItemImage>(html`\n <item-image\n .isListTile=${false}\n .isCompactTile=${false}\n .baseImageUrl=${baseImageUrl}\n >\n </item-image>\n `);\n\n // Doesn't set the image src if model is not present\n const img = el.shadowRoot?.querySelector('img');\n expect(img).to.exist;\n expect(img?.getAttribute('src')).not.to.exist;\n });\n\n it('should not fetch image with undefined identifier', async () => {\n const el = await fixture<ItemImage>(html`\n <item-image\n .isListTile=${false}\n .isCompactTile=${false}\n .model=${{}}\n .baseImageUrl=${baseImageUrl}\n >\n </item-image>\n `);\n\n // Doesn't set the image src if identifier is not present\n const img = el.shadowRoot?.querySelector('img');\n expect(img).to.exist;\n expect(img?.getAttribute('src')).not.to.exist;\n });\n});\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Result } from '@internetarchive/result-type';
|
|
2
2
|
import { SearchResponse, SearchServiceError } from '@internetarchive/search-service';
|
|
3
3
|
export declare const getMockSuccessSingleResult: () => Result<SearchResponse, SearchServiceError>;
|
|
4
|
+
export declare const getMockSuccessManyFields: () => Result<SearchResponse, SearchServiceError>;
|
|
4
5
|
export declare const getMockSuccessWithYearHistogramAggs: () => Result<SearchResponse, SearchServiceError>;
|
|
5
6
|
export declare const getMockSuccessLoggedInResult: () => Result<SearchResponse, SearchServiceError>;
|
|
6
7
|
export declare const getMockSuccessNoPreviewResult: () => Result<SearchResponse, SearchServiceError>;
|
|
@@ -11,11 +12,13 @@ export declare const getMockSuccessWithCollectionTitles: () => Result<SearchResp
|
|
|
11
12
|
export declare const getMockSuccessWithCollectionAggregations: () => Result<SearchResponse, SearchServiceError>;
|
|
12
13
|
export declare const getMockSuccessSingleResultWithSort: (resultsSpy: Function) => Result<SearchResponse, SearchServiceError>;
|
|
13
14
|
export declare const getMockSuccessMultipleResults: () => Result<SearchResponse, SearchServiceError>;
|
|
15
|
+
export declare const getMockSuccessNoResults: () => Result<SearchResponse, SearchServiceError>;
|
|
14
16
|
export declare const getMockSuccessMultiLineDescription: () => Result<SearchResponse, SearchServiceError>;
|
|
15
17
|
export declare const getMockSuccessExtraQuotedHref: () => Result<SearchResponse, SearchServiceError>;
|
|
16
18
|
export declare const getMockSuccessWithDefaultSort: () => Result<SearchResponse, SearchServiceError>;
|
|
17
19
|
export declare const getMockSuccessWithConciseDefaultSort: () => Result<SearchResponse, SearchServiceError>;
|
|
18
20
|
export declare const getMockSuccessWithDefaultFavSort: () => Result<SearchResponse, SearchServiceError>;
|
|
19
21
|
export declare const getMockSuccessWithParentCollections: () => Result<SearchResponse, SearchServiceError>;
|
|
22
|
+
export declare const getMockSuccessWithWebArchiveHits: () => Result<SearchResponse, SearchServiceError>;
|
|
20
23
|
export declare const getMockErrorResult: () => Result<SearchResponse, SearchServiceError>;
|
|
21
24
|
export declare const getMockMalformedResult: () => Result<SearchResponse, SearchServiceError>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Aggregation, ItemHit, SearchServiceError, TextHit, } from '@internetarchive/search-service';
|
|
2
|
+
import { WebArchiveHit } from '@internetarchive/search-service/dist/src/models/hit-types/web-archive-hit';
|
|
2
3
|
import { SearchServiceErrorType } from '@internetarchive/search-service/dist/src/search-service-error';
|
|
3
4
|
export const getMockSuccessSingleResult = () => ({
|
|
4
5
|
success: {
|
|
@@ -37,6 +38,64 @@ export const getMockSuccessSingleResult = () => ({
|
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
});
|
|
41
|
+
export const getMockSuccessManyFields = () => ({
|
|
42
|
+
success: {
|
|
43
|
+
request: {
|
|
44
|
+
kind: 'hits',
|
|
45
|
+
clientParameters: {
|
|
46
|
+
user_query: 'many-fields',
|
|
47
|
+
sort: [],
|
|
48
|
+
},
|
|
49
|
+
backendRequests: {
|
|
50
|
+
primary: {
|
|
51
|
+
kind: 'hits',
|
|
52
|
+
finalized_parameters: {
|
|
53
|
+
user_query: 'many-fields',
|
|
54
|
+
sort: [],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
rawResponse: {},
|
|
60
|
+
response: {
|
|
61
|
+
totalResults: 1,
|
|
62
|
+
returnedCount: 1,
|
|
63
|
+
results: [
|
|
64
|
+
new ItemHit({
|
|
65
|
+
fields: {
|
|
66
|
+
identifier: 'foo',
|
|
67
|
+
avg_rating: 3.5,
|
|
68
|
+
collection: ['foo', 'bar', 'no-preview', 'loggedin'],
|
|
69
|
+
collection_files_count: 123,
|
|
70
|
+
collection_size: 234,
|
|
71
|
+
creator: ['baz', 'boop'],
|
|
72
|
+
date: '2010-01-03T01:23:45Z',
|
|
73
|
+
addeddate: '2010-01-01T01:23:45Z',
|
|
74
|
+
publicdate: '2010-01-02T01:23:45Z',
|
|
75
|
+
reviewdate: '2010-01-04T01:23:45Z',
|
|
76
|
+
description: 'foo bar baz',
|
|
77
|
+
downloads: 246,
|
|
78
|
+
issue: 1,
|
|
79
|
+
item_count: 20,
|
|
80
|
+
mediatype: 'texts',
|
|
81
|
+
num_favorites: 12,
|
|
82
|
+
num_reviews: 23,
|
|
83
|
+
source: 'foo bar',
|
|
84
|
+
subject: ['baz', 'quux'],
|
|
85
|
+
title: 'Foo Bar',
|
|
86
|
+
volume: 2,
|
|
87
|
+
week: 50,
|
|
88
|
+
__href__: 'https://archive.org/details/foo',
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
responseHeader: {
|
|
94
|
+
succeeded: true,
|
|
95
|
+
query_time: 0,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
40
99
|
export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
41
100
|
success: {
|
|
42
101
|
request: {
|
|
@@ -365,6 +424,10 @@ export const getMockSuccessWithCollectionAggregations = () => ({
|
|
|
365
424
|
],
|
|
366
425
|
}),
|
|
367
426
|
},
|
|
427
|
+
collectionTitles: {
|
|
428
|
+
foo: 'Foo',
|
|
429
|
+
bar: 'Bar',
|
|
430
|
+
},
|
|
368
431
|
},
|
|
369
432
|
responseHeader: {
|
|
370
433
|
succeeded: true,
|
|
@@ -457,6 +520,36 @@ export const getMockSuccessMultipleResults = () => ({
|
|
|
457
520
|
},
|
|
458
521
|
},
|
|
459
522
|
});
|
|
523
|
+
export const getMockSuccessNoResults = () => ({
|
|
524
|
+
success: {
|
|
525
|
+
request: {
|
|
526
|
+
kind: 'hits',
|
|
527
|
+
clientParameters: {
|
|
528
|
+
user_query: 'no-results',
|
|
529
|
+
sort: [],
|
|
530
|
+
},
|
|
531
|
+
backendRequests: {
|
|
532
|
+
primary: {
|
|
533
|
+
kind: 'hits',
|
|
534
|
+
finalized_parameters: {
|
|
535
|
+
user_query: 'no-results',
|
|
536
|
+
sort: [],
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
rawResponse: {},
|
|
542
|
+
response: {
|
|
543
|
+
totalResults: 0,
|
|
544
|
+
returnedCount: 0,
|
|
545
|
+
results: [],
|
|
546
|
+
},
|
|
547
|
+
responseHeader: {
|
|
548
|
+
succeeded: true,
|
|
549
|
+
query_time: 0,
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
});
|
|
460
553
|
export const getMockSuccessMultiLineDescription = () => ({
|
|
461
554
|
success: {
|
|
462
555
|
request: {
|
|
@@ -701,6 +794,44 @@ export const getMockSuccessWithParentCollections = () => ({
|
|
|
701
794
|
},
|
|
702
795
|
},
|
|
703
796
|
});
|
|
797
|
+
export const getMockSuccessWithWebArchiveHits = () => ({
|
|
798
|
+
success: {
|
|
799
|
+
request: {
|
|
800
|
+
kind: 'hits',
|
|
801
|
+
clientParameters: {
|
|
802
|
+
user_query: 'web-archive',
|
|
803
|
+
sort: [],
|
|
804
|
+
},
|
|
805
|
+
backendRequests: {
|
|
806
|
+
primary: {
|
|
807
|
+
kind: 'hits',
|
|
808
|
+
finalized_parameters: {
|
|
809
|
+
user_query: 'web-archive',
|
|
810
|
+
sort: [],
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
rawResponse: {},
|
|
816
|
+
response: {
|
|
817
|
+
totalResults: 1,
|
|
818
|
+
returnedCount: 1,
|
|
819
|
+
results: [
|
|
820
|
+
new WebArchiveHit({
|
|
821
|
+
fields: {
|
|
822
|
+
url: 'https://example.com',
|
|
823
|
+
capture_dates: ['2010-01-02T03:04:05Z'],
|
|
824
|
+
__href__: 'https://web.archive.org/web/20100102030405/https%3A%2F%2Fexample.com',
|
|
825
|
+
},
|
|
826
|
+
}),
|
|
827
|
+
],
|
|
828
|
+
},
|
|
829
|
+
responseHeader: {
|
|
830
|
+
succeeded: true,
|
|
831
|
+
query_time: 0,
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
});
|
|
704
835
|
export const getMockErrorResult = () => ({
|
|
705
836
|
error: new SearchServiceError(SearchServiceErrorType.networkError, 'foo', {
|
|
706
837
|
message: 'bar',
|
|
@@ -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,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,EAAE,CAAC;SACd;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mCAAmC,GAG5C,GAAG,EAAE,CAAC,CAAC;IACT,OAAO,EAAE;QACP,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,gBAAgB,EAAE;gBAChB,UAAU,EAAE,OAAO;gBACnB,IAA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AK;qBACb;iBACF,CAAC;aACH;YACD,mBAAmB,EAAE;gBACnB,eAAe,EAAE;oBACf,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;iBAC3B;aACF;SACF;QACD,cAAc,EAAE;YACd,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,CAAC;SACd;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAG3B,GAAG,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,IAAI,kBAAkB,CAAC,sBAAsB,CAAC,YAAY,EAAE,KAAK,EAAE;QACxE,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC,CAAC;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 __href__: '/foo',\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n __href__: '/bar',\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 getMockSuccessWithDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort',\n sort: ['titleSorter', 'identifier'],\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': 'titleSorter',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithConciseDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort-concise',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort-concise',\n sort: ['addeddate:desc', 'identifier'],\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': '-addeddate',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultFavSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'fav-sort',\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n identifier: 'fav-foo',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithParentCollections: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'parent-collections',\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n collection: ['foo', 'bar'],\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,aAAa,EAAE,MAAM,2EAA2E,CAAC;AAC1G,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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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 { WebArchiveHit } from '@internetarchive/search-service/dist/src/models/hit-types/web-archive-hit';\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 getMockSuccessManyFields: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'many-fields',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'many-fields',\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 avg_rating: 3.5,\n collection: ['foo', 'bar', 'no-preview', 'loggedin'],\n collection_files_count: 123,\n collection_size: 234,\n creator: ['baz', 'boop'],\n date: '2010-01-03T01:23:45Z',\n addeddate: '2010-01-01T01:23:45Z',\n publicdate: '2010-01-02T01:23:45Z',\n reviewdate: '2010-01-04T01:23:45Z',\n description: 'foo bar baz',\n downloads: 246,\n issue: 1,\n item_count: 20,\n mediatype: 'texts',\n num_favorites: 12,\n num_reviews: 23,\n source: 'foo bar',\n subject: ['baz', 'quux'],\n title: 'Foo Bar',\n volume: 2,\n week: 50,\n __href__: 'https://archive.org/details/foo',\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 collectionTitles: {\n foo: 'Foo',\n bar: 'Bar',\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 __href__: '/foo',\n },\n }),\n new ItemHit({\n fields: {\n identifier: 'bar',\n collection: ['baz', 'boop'],\n __href__: '/bar',\n },\n }),\n ],\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessNoResults: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'no-results',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'no-results',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 0,\n returnedCount: 0,\n results: [],\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 getMockSuccessWithDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort',\n sort: ['titleSorter', 'identifier'],\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': 'titleSorter',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithConciseDefaultSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'default-sort-concise',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'default-sort-concise',\n sort: ['addeddate:desc', 'identifier'],\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n 'sort-by': '-addeddate',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithDefaultFavSort: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'fav-sort',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'fav-sort',\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n identifier: 'fav-foo',\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithParentCollections: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'parent-collections',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'parent-collections',\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 title: 'Foo',\n },\n }),\n ],\n collectionExtraInfo: {\n public_metadata: {\n collection: ['foo', 'bar'],\n },\n },\n },\n responseHeader: {\n succeeded: true,\n query_time: 0,\n },\n },\n});\n\nexport const getMockSuccessWithWebArchiveHits: () => Result<\n SearchResponse,\n SearchServiceError\n> = () => ({\n success: {\n request: {\n kind: 'hits',\n clientParameters: {\n user_query: 'web-archive',\n sort: [],\n },\n backendRequests: {\n primary: {\n kind: 'hits',\n finalized_parameters: {\n user_query: 'web-archive',\n sort: [],\n },\n },\n },\n },\n rawResponse: {},\n response: {\n totalResults: 1,\n returnedCount: 1,\n results: [\n new WebArchiveHit({\n fields: {\n url: 'https://example.com',\n capture_dates: ['2010-01-02T03:04:05Z'],\n __href__:\n 'https://web.archive.org/web/20100102030405/https%3A%2F%2Fexample.com',\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,4 +1,4 @@
|
|
|
1
|
-
import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, } from './mock-search-responses';
|
|
1
|
+
import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, getMockSuccessManyFields, getMockSuccessNoResults, getMockSuccessWithWebArchiveHits, } from './mock-search-responses';
|
|
2
2
|
const responses = {
|
|
3
3
|
'single-result': getMockSuccessSingleResult,
|
|
4
4
|
years: getMockSuccessWithYearHistogramAggs,
|
|
@@ -15,6 +15,9 @@ const responses = {
|
|
|
15
15
|
'default-sort-concise': getMockSuccessWithConciseDefaultSort,
|
|
16
16
|
'fav-sort': getMockSuccessWithDefaultFavSort,
|
|
17
17
|
'parent-collections': getMockSuccessWithParentCollections,
|
|
18
|
+
'web-archive': getMockSuccessWithWebArchiveHits,
|
|
19
|
+
'many-fields': getMockSuccessManyFields,
|
|
20
|
+
'no-results': getMockSuccessNoResults,
|
|
18
21
|
error: getMockErrorResult,
|
|
19
22
|
malformed: getMockMalformedResult,
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wCAAwC,EACxC,mCAAmC,EACnC,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EAChC,kBAAkB,EAClB,sBAAsB,EACtB,kCAAkC,EAClC,wCAAwC,EACxC,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,
|
|
1
|
+
{"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wCAAwC,EACxC,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CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,iCAAiC;YACjC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;gBACtB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;SACJ;QAED,MAAM,WAAW,GACf,MAAA,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,mCAAI,EAAE,CAAC;QAClE,MAAM,QAAQ,GACZ,MAAA,SAAS,CAAC,WAAW,CAAC,mCAAI,6BAA6B,CAAC;QAC1D,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QAExB,uCAAuC;QACvC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,WAAW,EAAE;YAC3C,MAAM,GAAG,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC9D;QAED,uCAAuC;QACvC,IAAI,MAAM,CAAC,OAAO,EAAE;YACjB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAwB,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;SACnE;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport type {\n SearchParams,\n SearchResponse,\n SearchServiceInterface,\n SearchServiceError,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n getMockSuccessSingleResult,\n getMockSuccessMultipleResults,\n getMockSuccessSingleResultWithSort,\n getMockSuccessLoggedInResult,\n getMockSuccessNoPreviewResult,\n getMockSuccessLoggedInAndNoPreviewResult,\n getMockSuccessWithYearHistogramAggs,\n getMockSuccessMultiLineDescription,\n getMockSuccessFirstTitleResult,\n getMockSuccessFirstCreatorResult,\n getMockErrorResult,\n getMockMalformedResult,\n getMockSuccessWithCollectionTitles,\n getMockSuccessWithCollectionAggregations,\n getMockSuccessExtraQuotedHref,\n getMockSuccessWithDefaultSort,\n getMockSuccessWithConciseDefaultSort,\n getMockSuccessWithDefaultFavSort,\n getMockSuccessWithParentCollections,\n getMockSuccessManyFields,\n getMockSuccessNoResults,\n getMockSuccessWithWebArchiveHits,\n} from './mock-search-responses';\n\nconst responses: Record<\n string,\n () => Result<SearchResponse, SearchServiceError>\n> = {\n 'single-result': getMockSuccessSingleResult,\n years: getMockSuccessWithYearHistogramAggs,\n 'multi-line-description': getMockSuccessMultiLineDescription,\n loggedin: getMockSuccessLoggedInResult,\n 'no-preview': getMockSuccessNoPreviewResult,\n 'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,\n 'first-title': getMockSuccessFirstTitleResult,\n 'first-creator': getMockSuccessFirstCreatorResult,\n 'collection-titles': getMockSuccessWithCollectionTitles,\n 'collection-aggregations': getMockSuccessWithCollectionAggregations,\n 'extra-quoted-href': getMockSuccessExtraQuotedHref,\n 'default-sort': getMockSuccessWithDefaultSort,\n 'default-sort-concise': getMockSuccessWithConciseDefaultSort,\n 'fav-sort': getMockSuccessWithDefaultFavSort,\n 'parent-collections': getMockSuccessWithParentCollections,\n 'web-archive': getMockSuccessWithWebArchiveHits,\n 'many-fields': getMockSuccessManyFields,\n 'no-results': getMockSuccessNoResults,\n error: getMockErrorResult,\n malformed: getMockMalformedResult,\n};\n\nexport class MockSearchService implements SearchServiceInterface {\n searchParams?: SearchParams;\n\n searchType?: SearchType;\n\n asyncResponse: boolean;\n\n asyncResponseDelay: number;\n\n resultsSpy: Function;\n\n constructor({\n asyncResponse = false,\n asyncResponseDelay = 0,\n resultsSpy = () => {},\n } = {}) {\n this.asyncResponse = asyncResponse;\n this.asyncResponseDelay = asyncResponseDelay;\n this.resultsSpy = resultsSpy;\n }\n\n async search(\n params: SearchParams,\n searchType: SearchType\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n this.searchParams = params;\n this.searchType = searchType;\n\n if (this.asyncResponse) {\n // Add an artificial 1-tick delay\n await new Promise(res => {\n setTimeout(res, this.asyncResponseDelay);\n });\n }\n\n const responseKey =\n (this.searchParams.query || this.searchParams.pageTarget) ?? '';\n const resultFn: () => Result<SearchResponse, SearchServiceError> =\n responses[responseKey] ?? getMockSuccessMultipleResults;\n let result = resultFn();\n\n // with-sort query has special handling\n if (this.searchParams.query === 'with-sort') {\n result = getMockSuccessSingleResultWithSort(this.resultsSpy);\n }\n\n // Apply any uid param from the request\n if (result.success) {\n (result.success.request.clientParameters as any).uid = params.uid;\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import/no-duplicates */
|
|
2
2
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
+
import sinon from 'sinon';
|
|
3
4
|
import { html } from 'lit';
|
|
4
5
|
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
5
6
|
import '../../src/sort-filter-bar/sort-filter-bar';
|
|
@@ -10,10 +11,14 @@ describe('Sort selector default buttons', async () => {
|
|
|
10
11
|
`);
|
|
11
12
|
const sortSelectorContainer = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#sort-selector-container');
|
|
12
13
|
const desktopSortSelector = sortSelectorContainer === null || sortSelectorContainer === void 0 ? void 0 : sortSelectorContainer.querySelector('#desktop-sort-selector');
|
|
13
|
-
|
|
14
|
+
beforeEach(async () => {
|
|
14
15
|
el.resizeObserver = new SharedResizeObserver();
|
|
15
16
|
await el.updateComplete;
|
|
16
17
|
});
|
|
18
|
+
afterEach(async () => {
|
|
19
|
+
el.resizeObserver = undefined;
|
|
20
|
+
await el.updateComplete;
|
|
21
|
+
});
|
|
17
22
|
it('should render basic component', async () => {
|
|
18
23
|
expect(sortSelectorContainer).to.exist;
|
|
19
24
|
expect(desktopSortSelector).to.exist;
|
|
@@ -403,15 +408,47 @@ describe('Sort/filter bar mobile view', () => {
|
|
|
403
408
|
backdrop = (_d = el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('#sort-selector-backdrop');
|
|
404
409
|
expect(backdrop).not.to.exist;
|
|
405
410
|
});
|
|
406
|
-
it('shows loansTab top-bar slot', async () => {
|
|
411
|
+
it('shows loansTab top-bar slot Default View', async () => {
|
|
407
412
|
var _a;
|
|
413
|
+
const resizeStub = new SharedResizeObserver();
|
|
414
|
+
const addSpy = sinon.spy(resizeStub, 'addObserver');
|
|
415
|
+
const removeSpy = sinon.spy(resizeStub, 'removeObserver');
|
|
408
416
|
const el = await fixture(html `
|
|
409
|
-
<sort-filter-bar></sort-filter-bar>
|
|
417
|
+
<sort-filter-bar .resizeObserver=${resizeStub}></sort-filter-bar>
|
|
418
|
+
`);
|
|
419
|
+
// this element exists
|
|
420
|
+
expect((_a = el === null || el === void 0 ? void 0 : el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#sort-selector-container')).to.exist;
|
|
421
|
+
// loads & unloads twice when [re]setting ResizeObserver
|
|
422
|
+
expect(addSpy.callCount).to.equal(2);
|
|
423
|
+
const resizeStub2 = new SharedResizeObserver();
|
|
424
|
+
el.resizeObserver = resizeStub2;
|
|
425
|
+
await el.updateComplete;
|
|
426
|
+
expect(removeSpy.callCount).to.equal(2);
|
|
427
|
+
});
|
|
428
|
+
it('shows loansTab top-bar slot Custom Slotted View', async () => {
|
|
429
|
+
var _a, _b;
|
|
430
|
+
const resizeStub = new SharedResizeObserver();
|
|
431
|
+
const addSpy = sinon.spy(resizeStub, 'addObserver');
|
|
432
|
+
const removeSpy = sinon.spy(resizeStub, 'removeObserver');
|
|
433
|
+
const el = await fixture(html `
|
|
434
|
+
<sort-filter-bar
|
|
435
|
+
.resizeObserver=${resizeStub}
|
|
436
|
+
.showLoansTopBar=${true}
|
|
437
|
+
></sort-filter-bar>
|
|
410
438
|
`);
|
|
411
|
-
el.showLoansTopBar = true;
|
|
412
439
|
await el.updateComplete;
|
|
440
|
+
// slot exists
|
|
413
441
|
const loansTabSlot = (_a = el === null || el === void 0 ? void 0 : el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
414
442
|
expect(loansTabSlot).to.exist;
|
|
443
|
+
// sort bar does not exist
|
|
444
|
+
expect((_b = el === null || el === void 0 ? void 0 : el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#sort-selector-container')).to.not
|
|
445
|
+
.exist;
|
|
446
|
+
const resizeStub2 = new SharedResizeObserver();
|
|
447
|
+
el.resizeObserver = resizeStub2;
|
|
448
|
+
await el.updateComplete;
|
|
449
|
+
// there's no need for resize observer
|
|
450
|
+
expect(addSpy.callCount).to.equal(0);
|
|
451
|
+
expect(removeSpy.callCount).to.equal(0);
|
|
415
452
|
});
|
|
416
453
|
});
|
|
417
454
|
//# sourceMappingURL=sort-filter-bar.test.js.map
|