Commit 4d7c2987 authored by lauraMon's avatar lauraMon

Renames function with better name

parent 569f27ff
......@@ -143,7 +143,7 @@ export default {
'clearRecentSearches',
'loadRecentSearches',
'setIndexPath',
'fetchResults',
'fetchPaginatedResults',
]),
setSearchText(text) {
this.errorSearchQuery = text;
......@@ -154,10 +154,10 @@ export default {
},
goToNextPage() {
this.pageValue = this.$options.NEXT_PAGE;
this.fetchResults(this.pagination.next.cursor);
this.fetchPaginatedResults(this.pagination.next.cursor);
},
goToPrevPage() {
this.fetchResults(this.pagination.previous.cursor);
this.fetchPaginatedResults(this.pagination.previous.cursor);
},
goToPage(page) {
window.scrollTo(0, 0);
......
......@@ -93,7 +93,7 @@ export const setEndpoint = ({ commit }, endpoint) => {
commit(types.SET_ENDPOINT, endpoint);
};
export const fetchResults = ({ commit, dispatch }, cursor) => {
export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => {
commit(types.SET_CURSOR, cursor);
dispatch('stopPolling');
dispatch('startPolling');
......
......@@ -71,7 +71,7 @@ describe('ErrorTrackingList', () => {
setEndpoint: jest.fn(),
searchByQuery: jest.fn(),
sortByField: jest.fn(),
fetchResults: jest.fn(),
fetchPaginatedResults: jest.fn(),
};
const state = {
......@@ -306,8 +306,8 @@ describe('ErrorTrackingList', () => {
it('fetches the previous page of results', () => {
expect(wrapper.find('.prev-page-item').attributes('aria-disabled')).toBe(undefined);
wrapper.vm.goToPrevPage();
expect(actions.fetchResults).toHaveBeenCalled();
expect(actions.fetchResults).toHaveBeenLastCalledWith(
expect(actions.fetchPaginatedResults).toHaveBeenCalled();
expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
'previousCursor',
undefined,
......@@ -325,8 +325,8 @@ describe('ErrorTrackingList', () => {
window.scrollTo = jest.fn();
findPagination().vm.$emit('input', 2);
expect(window.scrollTo).toHaveBeenCalledWith(0, 0);
expect(actions.fetchResults).toHaveBeenCalled();
expect(actions.fetchResults).toHaveBeenLastCalledWith(
expect(actions.fetchPaginatedResults).toHaveBeenCalled();
expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
'nextCursor',
undefined,
......
......@@ -118,11 +118,11 @@ describe('error tracking actions', () => {
});
});
describe('fetchResults', () => {
describe('fetchPaginatedResults', () => {
it('should start polling the selected page cursor', () => {
const cursor = '1576637570000:1:1';
testAction(
actions.fetchResults,
actions.fetchPaginatedResults,
cursor,
{},
[{ type: types.SET_CURSOR, payload: cursor }],
......
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