+
{customPaneSub}
+
+
+
getHelperResourcePath: {getHelperResourcePath('', 'testID1')}
+
+ {renderFilters(RequestFilterData.onChange)}
+
+
+
+
+
+
+
+ {actionMenu({ onToggle: jest.fn() })}
+
+
+ {Object.keys(columnMapping).map(column => columnMapping[column])}
+
+
+ {Object.keys(resultsFormatter).map(result => resultsFormatter[result](mockedRequest))}
+
+
+ );
+}));
+
+describe('RequestsRoute', () => {
+ const mockedUpdateFunc = jest.fn();
+ const mockRecordValues = [
+ {
+ instance: {
+ contributorNames: [
+ {
+ name: 'John Doe',
+ },
+ {
+ name: 'Jane Smith',
+ }
+ ],
+ },
+ tags: {
+ tagList: ['tag1', 'tag2'],
+ },
+ requester: {
+ firstName: 'Alice',
+ lastName: 'Johnson',
+ },
+ proxy: {
+ firstName: 'Bob',
+ lastName: 'Williams',
+ },
+ deliveryAddress: {
+ addressLine1: '123 Main St',
+ city: 'Cityville',
+ region: 'State',
+ postalCode: '12345',
+ countryId: 'US',
+ },
+ printDetails: printDetailsMockData,
+ }
+ ];
+ const defaultProps = {
+ history: historyData,
+ location: historyData.location,
+ match: {
+ params: {
+ noteId: 'viewNoteRouteID',
+ },
+ path: 'viewPath',
+ url: '{{ env.FOLIO_MD_REGISTRY }}/_/proxy/modules',
+ },
+ mutator: {
+ circulationSettings: {
+ GET: jest.fn(),
+ },
+ savePrintDetails: {
+ POST: jest.fn(),
+ },
+ activeRecord: {
+ update: jest.fn(),
+ },
+ currentServicePoint: {
+ update: jest.fn(),
+ },
+ resultOffset: {
+ replace: jest.fn(),
+ },
+ expiredHolds: {
+ GET: jest.fn(() => ({
+ requests: [
+ {
+ requester: {
+ firstName: 'firstName',
+ lastName: 'lastName',
+ name: '',
+ },
+ }
+ ],
+ })),
+ reset: jest.fn(),
+ },
+ patronBlocks: {
+ DELETE: jest.fn(),
+ },
+ pickSlips: {
+ GET: jest.fn(),
+ },
+ searchSlips: {
+ GET: jest.fn(),
+ },
+ proxy: {
+ reset: jest.fn(),
+ GET: jest.fn(),
+ },
+ query: {
+ update: mockedUpdateFunc,
+ },
+ staffSlips: {
+ GET: jest.fn(),
+ },
+ records: {
+ GET: jest.fn(),
+ POST: jest.fn().mockResolvedValue(),
+ },
+ reportRecords: {
+ GET: jest.fn().mockReturnValueOnce(mockRecordValues).mockRejectedValue(),
+ reset: jest.fn(),
+ },
+ requestCount: {
+ replace: jest.fn(),
+ },
+ resultCount: {
+ replace: jest.fn(),
+ },
+ },
+ stripes: {
+ connect: jest.fn(),
+ hasPerm: jest.fn().mockResolvedValue(true),
+ locale: 'en',
+ logger: {
+ log: jest.fn(),
+ },
+ okapi: {
+ url: 'url',
+ tenant: 'tenant',
+ },
+ store: {
+ getState: jest.fn(() => ({ okapi: { token: 'token' } })),
+ },
+ timezone: 'America/New_York',
+ user: {
+ user: {
+ username: 'rick'
+ }
+ },
+ },
+ resources: {
+ addressTypes: {
+ hasLoaded: true,
+ },
+ configs: {
+ hasLoaded: true,
+ records: [
+ {
+ value: 'testConfig',
+ }
+ ],
+ },
+ printHoldRequests: {
+ records: [{
+ value: '{"printHoldRequestsEnabled": true}',
+ }],
+ },
+ circulationSettings: {
+ records: [{
+ value: {
+ enablePrintLog: 'true',
+ }
+ }]
+ },
+ currentServicePoint: {},
+ patronBlocks: {
+ records: [
+ {
+ expirationDate: '2023-09-11',
+ }
+ ]
+ },
+ pickSlips: {
+ records: [
+ {
+ item: {
+ title: 'test title'
+ },
+ request: {
+ requestID: '393030bc-669e-4a41-81e9-3427c25a3b39',
+ }
+ }
+ ],
+ },
+ searchSlips: {
+ records: [
+ {
+ name: 'search slip',
+ }
+ ],
+ },
+ query: {
+ filters: 'filter1.value1,filter1.value2,filter2.value3',
+ instanceId: 'instanceId',
+ query: 'testQueryTerm',
+ },
+ records: {
+ hasLoaded: true,
+ isPending: false,
+ other: {
+ totalRecords: 1,
+ },
+ records: [mockedRequest],
+ },
+ staffSlips: {
+ records: [
+ {
+ name: 'staffSlipName',
+ }
+ ],
+ },
+ },
+ };
+ const defaultExpectedProps = {
+ requestType: DEFAULT_REQUEST_TYPE_VALUE,
+ fulfillmentPreference: 'Hold Shelf',
+ };
+ const sendCallout = jest.fn();
+
+ const renderComponent = (props = defaultProps) => {
+ const { rerender } = render(
+