Skip to content

Commit 8c2fe7b

Browse files
committed
fix: lint issues
1 parent 229d716 commit 8c2fe7b

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

src/library-authoring/collections/LibraryCollectionPage.test.tsx

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import {
99
} from '../../testUtils';
1010
import mockResult from '../__mocks__/collection-search.json';
1111
import mockEmptyResult from '../../search-modal/__mocks__/empty-search-result.json';
12-
import { mockCollection, mockContentLibrary, mockLibraryBlockTypes, mockXBlockFields } from '../data/api.mocks';
12+
import {
13+
mockCollection, mockContentLibrary, mockLibraryBlockTypes, mockXBlockFields,
14+
} from '../data/api.mocks';
1315
import { mockContentSearchConfig } from '../../search-manager/data/api.mock';
1416
import { mockBroadcastChannel } from '../../generic/data/api.mock';
1517
import { LibraryLayout } from '..';
@@ -38,27 +40,6 @@ const returnEmptyResult = (_url, req) => {
3840
return mockEmptyResult;
3941
};
4042

41-
/**
42-
* Returns 2 components from the search query.
43-
* This lets us test that the StudioHome "View All" button is hidden when a
44-
* low number of search results are shown (<=4 by default).
45-
*/
46-
const returnLowNumberResults = (_url, req) => {
47-
const requestData = JSON.parse(req.body?.toString() ?? '');
48-
const query = requestData?.queries[0]?.q ?? '';
49-
const newMockResult = { ...mockResult };
50-
// We have to replace the query (search keywords) in the mock results with the actual query,
51-
// because otherwise we may have an inconsistent state that causes more queries and unexpected results.
52-
newMockResult.results[0].query = query;
53-
// Limit number of results to just 2
54-
newMockResult.results[0].hits = mockResult.results[0]?.hits.slice(0, 2);
55-
newMockResult.results[0].estimatedTotalHits = 2;
56-
// And fake the required '_formatted' fields; it contains the highlighting <mark>...</mark> around matched words
57-
// eslint-disable-next-line no-underscore-dangle, no-param-reassign
58-
newMockResult.results[0]?.hits.forEach((hit) => { hit._formatted = { ...hit }; });
59-
return newMockResult;
60-
};
61-
6243
const path = '/library/:libraryId/*';
6344
const libraryTitle = mockContentLibrary.libraryData.title;
6445
const collectionTitle = mockCollection.collectionData.title;
@@ -94,7 +75,7 @@ describe('<LibraryCollectionPage />', () => {
9475
path,
9576
routerProps: {
9677
initialEntries: [`/library/${libId}/collections/${colId}`],
97-
}
78+
},
9879
});
9980
};
10081

0 commit comments

Comments
 (0)