diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 18:06:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 18:06:24 +0300 |
commit | 88542a5e9613c8442a982e65ad5cf13eb33bc541 (patch) | |
tree | 11a65d86e623b443b8a2976cc93cff360e2da8a2 /spec/frontend/error_tracking/store | |
parent | b570d73ecd31e2ca9cf8c2f1adb056edf2869477 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/error_tracking/store')
-rw-r--r-- | spec/frontend/error_tracking/store/list/actions_spec.js | 29 | ||||
-rw-r--r-- | spec/frontend/error_tracking/store/list/getters_spec.js | 33 |
2 files changed, 29 insertions, 33 deletions
diff --git a/spec/frontend/error_tracking/store/list/actions_spec.js b/spec/frontend/error_tracking/store/list/actions_spec.js new file mode 100644 index 00000000000..dba1b31b9f3 --- /dev/null +++ b/spec/frontend/error_tracking/store/list/actions_spec.js @@ -0,0 +1,29 @@ +import axios from '~/lib/utils/axios_utils'; +import MockAdapter from 'axios-mock-adapter'; +import * as actions from '~/error_tracking/store/list/actions'; +import * as types from '~/error_tracking/store/list/mutation_types'; + +describe('error tracking actions', () => { + let mock; + + beforeEach(() => { + mock = new MockAdapter(axios); + }); + + afterEach(() => { + mock.restore(); + }); + + describe('startPolling', () => { + it('commits SET_LOADING', () => { + mock.onGet().reply(200); + const endpoint = '/errors'; + const commit = jest.fn(); + const state = {}; + + actions.startPolling({ commit, state }, endpoint); + + expect(commit).toHaveBeenCalledWith(types.SET_LOADING, true); + }); + }); +}); diff --git a/spec/frontend/error_tracking/store/list/getters_spec.js b/spec/frontend/error_tracking/store/list/getters_spec.js deleted file mode 100644 index 3cd7fa37d44..00000000000 --- a/spec/frontend/error_tracking/store/list/getters_spec.js +++ /dev/null @@ -1,33 +0,0 @@ -import * as getters from '~/error_tracking/store/list/getters'; - -describe('Error Tracking getters', () => { - let state; - - const mockErrors = [ - { title: 'ActiveModel::MissingAttributeError: missing attribute: encrypted_password' }, - { title: 'Grape::Exceptions::MethodNotAllowed: Grape::Exceptions::MethodNotAllowed' }, - { title: 'NoMethodError: undefined method `sanitize_http_headers=' }, - { title: 'NoMethodError: undefined method `pry' }, - ]; - - beforeEach(() => { - state = { - errors: mockErrors, - }; - }); - - describe('search results', () => { - it('should return errors filtered by words in title matching the query', () => { - const filteredErrors = getters.filterErrorsByTitle(state)('NoMethod'); - - expect(filteredErrors).not.toContainEqual(mockErrors[0]); - expect(filteredErrors.length).toBe(2); - }); - - it('should not return results if there is no matching query', () => { - const filteredErrors = getters.filterErrorsByTitle(state)('GitLab'); - - expect(filteredErrors.length).toBe(0); - }); - }); -}); |