Commit 331f903b authored by Scott Hampton's avatar Scott Hampton

Remove redundant if statement

Removed an if statement that was already
being called on the element itself.

Also made sure the groupProjects query was
only being called one time.

Also did a small refactor to the
createComponent function arguments.
parent dd9c3eed
......@@ -136,11 +136,10 @@ export default {
this.selectedDateRange = dateRange;
},
loadMoreProjects() {
if (this.projectsPageInfo.hasNextPage) {
this.$apollo.queries.groupProjects.fetchMore({
variables: {
groupFullPath: this.groupFullPath,
after: this.projectsPageInfo?.endCursor,
after: this.projectsPageInfo.endCursor,
},
updateQuery(previousResult, { fetchMoreResult }) {
const results = produce(fetchMoreResult, draftData => {
......@@ -153,7 +152,6 @@ export default {
return results;
},
});
}
},
},
text: {
......
......@@ -39,7 +39,7 @@ describe('Group repository analytics app', () => {
};
const groupProjectsData = [{ id: 1, name: '1' }, { id: 2, name: '2' }];
const createComponent = ({ data = {}, apolloGroupProjects = {} }) => {
const createComponent = ({ data = {}, apolloGroupProjects = {} } = {}) => {
wrapper = shallowMount(GroupRepositoryAnalytics, {
localVue,
data() {
......@@ -71,7 +71,7 @@ describe('Group repository analytics app', () => {
};
beforeEach(() => {
createComponent({});
createComponent();
});
afterEach(() => {
......@@ -171,7 +171,7 @@ describe('Group repository analytics app', () => {
});
it('makes a query to fetch more projects', () => {
expect(wrapper.vm.$apollo.queries.groupProjects.fetchMore).toHaveBeenCalled();
expect(wrapper.vm.$apollo.queries.groupProjects.fetchMore).toHaveBeenCalledTimes(1);
});
});
......
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