diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-26 00:06:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-26 00:06:20 +0300 |
commit | e95a97594ae2da675cb80fdb2ecb2ae64526d1d4 (patch) | |
tree | d7ea0e8380e99b53d0103a851400a8b3d4a62e02 /spec/frontend/error_tracking | |
parent | 6ac3c67986a7007aa93a22843085e5a87b55f61a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/error_tracking')
-rw-r--r-- | spec/frontend/error_tracking/store/getters_spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/frontend/error_tracking/store/getters_spec.js b/spec/frontend/error_tracking/store/getters_spec.js new file mode 100644 index 00000000000..371dfae373b --- /dev/null +++ b/spec/frontend/error_tracking/store/getters_spec.js @@ -0,0 +1,33 @@ +import * as getters from '~/error_tracking/store/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); + }); + }); +}); |