From 93171c3c1d9a7a9ce25dfd686a1cab7a36bcc46e Mon Sep 17 00:00:00 2001 From: Daniel Valenzuela Date: Mon, 28 Oct 2024 00:12:43 -0300 Subject: [PATCH] fixup! fixup! fix: mocks and tests --- .../LibraryAuthoringPage.test.tsx | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/library-authoring/LibraryAuthoringPage.test.tsx b/src/library-authoring/LibraryAuthoringPage.test.tsx index 85fffa05b..6a2d35518 100644 --- a/src/library-authoring/LibraryAuthoringPage.test.tsx +++ b/src/library-authoring/LibraryAuthoringPage.test.tsx @@ -52,36 +52,6 @@ const returnEmptyResult = (_url, req) => { return mockEmptyResult; }; -/** - * Returns 2 components from the search query. - * This lets us test that the StudioHome "View All" button is hidden when a - * low number of search results are shown (<=4 by default). -*/ -const returnLowNumberResults = (_url, req) => { - const requestData = JSON.parse(req.body?.toString() ?? ''); - const query = requestData?.queries[0]?.q ?? ''; - const newMockResult = { ...mockResult }; - // We have to replace the query (search keywords) in the mock results with the actual query, - // because otherwise we may have an inconsistent state that causes more queries and unexpected results. - newMockResult.results[0].query = query; - newMockResult.results[3].query = query; - // Limit number of results to just 2 - newMockResult.results[0].hits = mockResult.results[0]?.hits.slice(0, 2); - newMockResult.results[2].hits = mockResult.results[2]?.hits.slice(0, 2); - newMockResult.results[3].hits = mockResult.results[2]?.hits.slice(0, 2); - newMockResult.results[0].estimatedTotalHits = 2; - newMockResult.results[2].estimatedTotalHits = 2; - newMockResult.results[3].estimatedTotalHits = 2; - // And fake the required '_formatted' fields; it contains the highlighting ... around matched words - // eslint-disable-next-line no-underscore-dangle, no-param-reassign - newMockResult.results[0]?.hits.forEach((hit) => { hit._formatted = { ...hit }; }); - // eslint-disable-next-line no-underscore-dangle, no-param-reassign - newMockResult.results[2]?.hits.forEach((hit) => { hit._formatted = { ...hit }; }); - // eslint-disable-next-line no-underscore-dangle, no-param-reassign - newMockResult.results[3]?.hits.forEach((hit) => { hit._formatted = { ...hit }; }); - return newMockResult; -}; - const path = '/library/:libraryId/*'; const libraryTitle = mockContentLibrary.libraryData.title;