summaryrefslogtreecommitdiff
path: root/spec/frontend/error_tracking
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-21 00:07:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-21 00:07:40 +0000
commitbb348db4c22bf58ac685fcd66445ac172491b302 (patch)
treeaca3fcf2e361989744ddaee559b51761100472ed /spec/frontend/error_tracking
parentbe59dd1d43332496def276c8d3e78fc82e94273a (diff)
downloadgitlab-ce-bb348db4c22bf58ac685fcd66445ac172491b302.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/error_tracking')
-rw-r--r--spec/frontend/error_tracking/components/error_tracking_list_spec.js13
-rw-r--r--spec/frontend/error_tracking/store/list/actions_spec.js20
2 files changed, 24 insertions, 9 deletions
diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
index d0893c0de01..f00ba884a6c 100644
--- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js
+++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js
@@ -71,6 +71,7 @@ describe('ErrorTrackingList', () => {
setEndpoint: jest.fn(),
searchByQuery: jest.fn(),
sortByField: jest.fn(),
+ fetchPaginatedResults: jest.fn(),
};
const state = {
@@ -305,10 +306,10 @@ 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.startPolling).toHaveBeenCalledTimes(2);
- expect(actions.startPolling).toHaveBeenLastCalledWith(
+ expect(actions.fetchPaginatedResults).toHaveBeenCalled();
+ expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
- '/path?cursor=previousCursor',
+ 'previousCursor',
undefined,
);
});
@@ -324,10 +325,10 @@ describe('ErrorTrackingList', () => {
window.scrollTo = jest.fn();
findPagination().vm.$emit('input', 2);
expect(window.scrollTo).toHaveBeenCalledWith(0, 0);
- expect(actions.startPolling).toHaveBeenCalledTimes(2);
- expect(actions.startPolling).toHaveBeenLastCalledWith(
+ expect(actions.fetchPaginatedResults).toHaveBeenCalled();
+ expect(actions.fetchPaginatedResults).toHaveBeenLastCalledWith(
expect.anything(),
- '/path?cursor=nextCursor',
+ 'nextCursor',
undefined,
);
});
diff --git a/spec/frontend/error_tracking/store/list/actions_spec.js b/spec/frontend/error_tracking/store/list/actions_spec.js
index 7906738f5b0..54fdde88818 100644
--- a/spec/frontend/error_tracking/store/list/actions_spec.js
+++ b/spec/frontend/error_tracking/store/list/actions_spec.js
@@ -79,6 +79,7 @@ describe('error tracking actions', () => {
query,
{},
[
+ { type: types.SET_CURSOR, payload: null },
{ type: types.SET_SEARCH_QUERY, payload: query },
{ type: types.ADD_RECENT_SEARCH, payload: query },
],
@@ -93,15 +94,15 @@ describe('error tracking actions', () => {
testAction(
actions.sortByField,
- { field },
+ field,
{},
- [{ type: types.SET_SORT_FIELD, payload: { field } }],
+ [{ type: types.SET_CURSOR, payload: null }, { type: types.SET_SORT_FIELD, payload: field }],
[{ type: 'stopPolling' }, { type: 'startPolling' }],
);
});
});
- describe('setEnpoint', () => {
+ describe('setEndpoint', () => {
it('should set search endpoint', () => {
const endpoint = 'https://sentry.io';
@@ -114,4 +115,17 @@ describe('error tracking actions', () => {
);
});
});
+
+ describe('fetchPaginatedResults', () => {
+ it('should start polling the selected page cursor', () => {
+ const cursor = '1576637570000:1:1';
+ testAction(
+ actions.fetchPaginatedResults,
+ cursor,
+ {},
+ [{ type: types.SET_CURSOR, payload: cursor }],
+ [{ type: 'stopPolling' }, { type: 'startPolling' }],
+ );
+ });
+ });
});