diff options
Diffstat (limited to 'spec/frontend/search/sidebar/components/app_spec.js')
-rw-r--r-- | spec/frontend/search/sidebar/components/app_spec.js | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/spec/frontend/search/sidebar/components/app_spec.js b/spec/frontend/search/sidebar/components/app_spec.js index ba492833ec4..aace9c8f83e 100644 --- a/spec/frontend/search/sidebar/components/app_spec.js +++ b/spec/frontend/search/sidebar/components/app_spec.js @@ -4,9 +4,10 @@ import Vuex from 'vuex'; import { MOCK_QUERY } from 'jest/search/mock_data'; import GlobalSearchSidebar from '~/search/sidebar/components/app.vue'; import IssuesFilters from '~/search/sidebar/components/issues_filters.vue'; +import MergeRequestsFilters from '~/search/sidebar/components/merge_requests_filters.vue'; +import BlobsFilters from '~/search/sidebar/components/blobs_filters.vue'; import ScopeLegacyNavigation from '~/search/sidebar/components/scope_legacy_navigation.vue'; import ScopeSidebarNavigation from '~/search/sidebar/components/scope_sidebar_navigation.vue'; -import LanguageFilter from '~/search/sidebar/components/language_filter/index.vue'; Vue.use(Vuex); @@ -17,7 +18,7 @@ describe('GlobalSearchSidebar', () => { currentScope: jest.fn(() => 'issues'), }; - const createComponent = (initialState = {}, featureFlags = {}) => { + const createComponent = (initialState = {}) => { const store = new Vuex.Store({ state: { urlQuery: MOCK_QUERY, @@ -28,19 +29,15 @@ describe('GlobalSearchSidebar', () => { wrapper = shallowMount(GlobalSearchSidebar, { store, - provide: { - glFeatures: { - ...featureFlags, - }, - }, }); }; const findSidebarSection = () => wrapper.find('section'); - const findFilters = () => wrapper.findComponent(IssuesFilters); + const findIssuesFilters = () => wrapper.findComponent(IssuesFilters); + const findMergeRequestsFilters = () => wrapper.findComponent(MergeRequestsFilters); + const findBlobsFilters = () => wrapper.findComponent(BlobsFilters); const findScopeLegacyNavigation = () => wrapper.findComponent(ScopeLegacyNavigation); const findScopeSidebarNavigation = () => wrapper.findComponent(ScopeSidebarNavigation); - const findLanguageAggregation = () => wrapper.findComponent(LanguageFilter); describe('renders properly', () => { describe('always', () => { @@ -53,23 +50,18 @@ describe('GlobalSearchSidebar', () => { }); describe.each` - scope | showFilters | showsLanguage - ${'issues'} | ${true} | ${false} - ${'merge_requests'} | ${true} | ${false} - ${'projects'} | ${false} | ${false} - ${'blobs'} | ${false} | ${true} - `('sidebar scope: $scope', ({ scope, showFilters, showsLanguage }) => { + scope | filter + ${'issues'} | ${findIssuesFilters} + ${'merge_requests'} | ${findMergeRequestsFilters} + ${'blobs'} | ${findBlobsFilters} + `('with sidebar $scope scope:', ({ scope, filter }) => { beforeEach(() => { getterSpies.currentScope = jest.fn(() => scope); createComponent({ urlQuery: { scope } }); }); - it(`${!showFilters ? "doesn't" : ''} shows filters`, () => { - expect(findFilters().exists()).toBe(showFilters); - }); - - it(`${!showsLanguage ? "doesn't" : ''} shows language filters`, () => { - expect(findLanguageAggregation().exists()).toBe(showsLanguage); + it(`shows filter ${filter.name.replace('find', '')}`, () => { + expect(filter().exists()).toBe(true); }); }); |