Commit 59fbd350 authored by mfluharty's avatar mfluharty

More changes from feedback

Improve/add tests for GraphQL cases in setPage
Remove no cache policy from GraphQL client
Add comment about issue file path
parent 851d64e3
export const parseCodeclimateMetrics = (issues = [], blobPath = '') => {
return issues.map((issue) => {
// the `file_path` attribute from the artifact is returned as `file` by GraphQL
const issuePath = issue.file_path || issue.path;
const parsedIssue = {
name: issue.description,
......
import createGqClient, { fetchPolicies } from '~/lib/graphql';
import createGqClient from '~/lib/graphql';
export const gqClient = createGqClient(
{},
{
fetchPolicy: fetchPolicies.NO_CACHE,
},
);
export const gqClient = createGqClient();
......@@ -52,17 +52,48 @@ describe('Codequality report actions', () => {
);
});
it('sets the page number with feature flag enabled', (done) => {
window.gon = { features: { graphqlCodeQualityFullReport: true } };
describe('with the feature flag enabled', () => {
let mockPageInfo;
return testAction(
actions.setPage,
12,
state,
[{ type: types.SET_PAGE, payload: { after: '', currentPage: 12 } }],
[{ type: 'fetchReport' }],
done,
);
beforeEach(() => {
window.gon = { features: { graphqlCodeQualityFullReport: true } };
mockPageInfo = {
...mockGraphqlPagination,
currentPage: 11,
};
});
it('sets the next page number', (done) => {
return testAction(
actions.setPage,
12,
{ ...state, pageInfo: mockPageInfo },
[
{
type: types.SET_PAGE,
payload: { after: mockGraphqlPagination.endCursor, currentPage: 12 },
},
],
[{ type: 'fetchReport' }],
done,
);
});
it('sets the previous page number', (done) => {
return testAction(
actions.setPage,
10,
{ ...state, pageInfo: mockPageInfo },
[
{
type: types.SET_PAGE,
payload: { after: mockGraphqlPagination.startCursor, currentPage: 10 },
},
],
[{ type: 'fetchReport' }],
done,
);
});
});
});
......
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