Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Melnyshyn committed Aug 29, 2024
1 parent 7e2278e commit 2c62915
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 78 deletions.
62 changes: 32 additions & 30 deletions src/components/InstancesList/InstancesList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,36 +122,38 @@ const getInstancesListTree = ({ segment, ...rest }) => {
<Harness translations={translationsProperties}>
<Router history={history}>
<ModuleHierarchyProvider module="@folio/inventory">
<InstancesList
parentResources={resources}
parentMutator={{
resultOffset: { replace: mockResultOffsetReplace },
resultCount: { replace: noop },
query: { update: updateMock, replace: mockQueryReplace },
records: { reset: mockRecordsReset },
itemsByQuery: { reset: noop, GET: mockItemsByQuery },
}}
data={{
...data,
query
}}
onSelectRow={noop}
renderFilters={renderer({
...data,
query,
parentResources: resources,
})}
segment={segment}
searchableIndexes={indexes}
searchableIndexesES={indexesES}
fetchFacets={noop}
getLastBrowse={jest.fn()}
getLastSearchOffset={mockGetLastSearchOffset}
storeLastSearch={mockStoreLastSearch}
storeLastSearchOffset={mockStoreLastSearchOffset}
storeLastSegment={noop}
{...rest}
/>
<div id="ModuleContainer">
<InstancesList
parentResources={resources}
parentMutator={{
resultOffset: { replace: mockResultOffsetReplace },
resultCount: { replace: noop },
query: { update: updateMock, replace: mockQueryReplace },
records: { reset: mockRecordsReset },
itemsByQuery: { reset: noop, GET: mockItemsByQuery },
}}
data={{
...data,
query
}}
onSelectRow={noop}
renderFilters={renderer({
...data,
query,
parentResources: resources,
})}
segment={segment}
searchableIndexes={indexes}
searchableIndexesES={indexesES}
fetchFacets={noop}
getLastBrowse={jest.fn()}
getLastSearchOffset={mockGetLastSearchOffset}
storeLastSearch={mockStoreLastSearch}
storeLastSearchOffset={mockStoreLastSearchOffset}
storeLastSegment={noop}
{...rest}
/>
</div>
</ModuleHierarchyProvider>
</Router>
</Harness>
Expand Down
98 changes: 50 additions & 48 deletions src/routes/InstancesRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,55 +71,57 @@ const InstancesRouteSetup = ({
storeLastBrowseOffset: jest.fn(),
}}
>
<Paneset>
<Layer
isOpen
contentLabel="label"
>
<OverlayContainer />
<InstancesRoute
resources={{
query: {
query: '',
sort: 'title',
},
records: {
hasLoaded: true,
resource: 'records',
records: instances,
other: { totalRecords: instances.length },
},
recordsBrowseCallNumber : {
hasLoaded: true,
resource: 'records',
records: callNumbers,
other: {
totalRecords: callNumbers.length
<div id="ModuleContainer">
<Paneset>
<Layer
isOpen
contentLabel="label"
>
<OverlayContainer />
<InstancesRoute
resources={{
query: {
query: '',
sort: 'title',
},
},
facets: {
hasLoaded: true,
resource: 'facets',
records: [],
other: { totalRecords: 0 },
},
resultCount: instances.length,
resultOffset: 0,
}}
mutator={{
quickExport: { POST: quickExportPOST },
resultCount: { replace: noop },
resultOffset: { replace: noop },
query: {
update: jest.fn(),
replace: jest.fn(),
},
browseModeRecords: { reset: jest.fn() },
records: { reset: jest.fn() },
}}
/>
</Layer>
</Paneset>
records: {
hasLoaded: true,
resource: 'records',
records: instances,
other: { totalRecords: instances.length },
},
recordsBrowseCallNumber : {
hasLoaded: true,
resource: 'records',
records: callNumbers,
other: {
totalRecords: callNumbers.length
},
},
facets: {
hasLoaded: true,
resource: 'facets',
records: [],
other: { totalRecords: 0 },
},
resultCount: instances.length,
resultOffset: 0,
}}
mutator={{
quickExport: { POST: quickExportPOST },
resultCount: { replace: noop },
resultOffset: { replace: noop },
query: {
update: jest.fn(),
replace: jest.fn(),
},
browseModeRecords: { reset: jest.fn() },
records: { reset: jest.fn() },
}}
/>
</Layer>
</Paneset>
</div>
</LastSearchTermsContext.Provider>
</DataContext.Provider>
</ModuleHierarchyProvider>
Expand Down

0 comments on commit 2c62915

Please sign in to comment.