diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/frontend/search/store/getters_spec.js | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/frontend/search/store/getters_spec.js')
-rw-r--r-- | spec/frontend/search/store/getters_spec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/frontend/search/store/getters_spec.js b/spec/frontend/search/store/getters_spec.js new file mode 100644 index 00000000000..081e6a986eb --- /dev/null +++ b/spec/frontend/search/store/getters_spec.js @@ -0,0 +1,32 @@ +import { GROUPS_LOCAL_STORAGE_KEY, PROJECTS_LOCAL_STORAGE_KEY } from '~/search/store/constants'; +import * as getters from '~/search/store/getters'; +import createState from '~/search/store/state'; +import { MOCK_QUERY, MOCK_GROUPS, MOCK_PROJECTS } from '../mock_data'; + +describe('Global Search Store Getters', () => { + let state; + + beforeEach(() => { + state = createState({ query: MOCK_QUERY }); + }); + + describe('frequentGroups', () => { + beforeEach(() => { + state.frequentItems[GROUPS_LOCAL_STORAGE_KEY] = MOCK_GROUPS; + }); + + it('returns the correct data', () => { + expect(getters.frequentGroups(state)).toStrictEqual(MOCK_GROUPS); + }); + }); + + describe('frequentProjects', () => { + beforeEach(() => { + state.frequentItems[PROJECTS_LOCAL_STORAGE_KEY] = MOCK_PROJECTS; + }); + + it('returns the correct data', () => { + expect(getters.frequentProjects(state)).toStrictEqual(MOCK_PROJECTS); + }); + }); +}); |