Commit a392abcc authored by Jose Vargas's avatar Jose Vargas

Add pageInfo to merge function

This adds the `pageInfo` property to the result
of the merge function of the jobs cache to allow
the correct results to be merged
parent f55115d0
......@@ -22,6 +22,7 @@ export default {
return {
nodes,
statuses: Array.isArray(args.statuses) ? [...args.statuses] : args.statuses,
pageInfo: incoming.pageInfo,
};
},
},
......
......@@ -32,6 +32,22 @@ describe('jobs/components/table/graphql/cache_config', () => {
CIJobConnectionIncomingCache.nodes.length + CIJobConnectionExistingCache.nodes.length,
);
});
it('should contain the pageInfo key as part of the result', () => {
const res = cacheConfig.typePolicies.CiJobConnection.merge({}, CIJobConnectionIncomingCache, {
args: firstLoadArgs,
});
expect(res.pageInfo).toEqual(
expect.objectContaining({
__typename: 'PageInfo',
endCursor: 'eyJpZCI6IjIwNTEifQ',
hasNextPage: true,
hasPreviousPage: false,
startCursor: 'eyJpZCI6IjIxNzMifQ',
}),
);
});
});
describe('when fetching data with different statuses', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment