Skip to content

Commit

Permalink
add mock for stripes-connect props parameter to ViewAllLogs test
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Oct 2, 2023
1 parent 4bfff34 commit a050779
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions src/routes/ViewAllLogs/ViewAllLogs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const mutator = buildMutator({
},
jobProfiles: {
GET: noop,
},
splitStatus: {
GET: noop,
}
});

Expand Down Expand Up @@ -128,6 +131,10 @@ const getResources = query => ({
},
totalRecords: 100,
},
splitStatus: {
hasLoaded: true,
records: [{ splitStatus: true }]
}
});

jest.mock('@folio/stripes/components', () => ({
Expand Down Expand Up @@ -158,6 +165,16 @@ jest.mock('@folio/stripes/components', () => ({
const deleteJobExecutionsSpy = jest.spyOn(utils, 'deleteJobExecutions');

const stripes = buildStripes();
const mockFunctionalManifestProps = (loaded, splitStatus) => (
{
resources: {
splitStatus: {
hasLoaded: loaded,
records: [{ splitStatus: splitStatus }]
}
}
}
)

const renderViewAllLogs = query => {
const component = (
Expand Down Expand Up @@ -559,7 +576,12 @@ describe('ViewAllLogs component', () => {
},
};

const query = ViewAllLogsManifest.records.params(null, null, queryData);
const query = ViewAllLogsManifest.records.params(
null,
null,
queryData,
null,
mockFunctionalManifestProps(true, true));
expect(query.hrId).toEqual(expectedQuery);
});
});
Expand All @@ -579,7 +601,12 @@ describe('ViewAllLogs component', () => {
},
};

const query = ViewAllLogsManifest.records.params(null, null, queryData);
const query = ViewAllLogsManifest.records.params(
null,
null,
queryData,
null,
mockFunctionalManifestProps(true, true));
expect(query).toMatchObject(expected);
});
});
Expand All @@ -594,7 +621,12 @@ describe('ViewAllLogs component', () => {
},
};

const query = ViewAllLogsManifest.records.params(null, null, queryData);
const query = ViewAllLogsManifest.records.params(
null,
null,
queryData,
null,
mockFunctionalManifestProps(true, true));
expect(expectedSortBy).toEqual(query.sortBy);
});

Expand All @@ -606,7 +638,12 @@ describe('ViewAllLogs component', () => {
},
};

const query = ViewAllLogsManifest.records.params(null, null, queryData);
const query = ViewAllLogsManifest.records.params(
null,
null,
queryData,
null,
mockFunctionalManifestProps(true, true));
expect(expectedSortBy).toEqual(query.sortBy);
});
});
Expand Down

0 comments on commit a050779

Please sign in to comment.