Commit 4d7c2987 authored by lauraMon's avatar lauraMon

Renames function with better name

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