diff options
Diffstat (limited to 'spec/frontend/feature_flags')
14 files changed, 89 insertions, 94 deletions
diff --git a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js index 06b9385b112..21b894ccbef 100644 --- a/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js +++ b/spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js @@ -36,7 +36,7 @@ describe('Configure Feature Flags Modal', () => { const findPrimaryAction = () => findGlModal().props('actionPrimary'); const findProjectNameInput = () => wrapper.find('#project_name_verification'); const findDangerGlAlert = () => - wrapper.findAll(GlAlert).filter(c => c.props('variant') === 'danger'); + wrapper.findAll(GlAlert).filter((c) => c.props('variant') === 'danger'); describe('idle', () => { afterEach(() => wrapper.destroy()); diff --git a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js index f8e25925774..a754c682356 100644 --- a/spec/frontend/feature_flags/components/edit_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/edit_feature_flag_spec.js @@ -42,7 +42,7 @@ describe('Edit feature flag form', () => { }); }; - beforeEach(done => { + beforeEach((done) => { mock = new MockAdapter(axios); mock.onGet(`${TEST_HOST}/feature_flags.json`).replyOnce(200, { id: 21, diff --git a/spec/frontend/feature_flags/components/environments_dropdown_spec.js b/spec/frontend/feature_flags/components/environments_dropdown_spec.js index 917f5f5ccd3..042fccaa369 100644 --- a/spec/frontend/feature_flags/components/environments_dropdown_spec.js +++ b/spec/frontend/feature_flags/components/environments_dropdown_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import { shallowMount } from '@vue/test-utils'; -import { GlLoadingIcon, GlDeprecatedButton, GlSearchBoxByType } from '@gitlab/ui'; +import { GlLoadingIcon, GlButton, GlSearchBoxByType } from '@gitlab/ui'; import { TEST_HOST } from 'spec/test_constants'; import waitForPromises from 'helpers/wait_for_promises'; import EnvironmentsDropdown from '~/feature_flags/components/environments_dropdown.vue'; @@ -11,7 +11,7 @@ describe('Feature flags > Environments dropdown ', () => { let wrapper; let mock; const results = ['production', 'staging']; - const factory = props => { + const factory = (props) => { wrapper = shallowMount(EnvironmentsDropdown, { propsData: { ...props, @@ -99,8 +99,8 @@ describe('Feature flags > Environments dropdown ', () => { it('emits event when a suggestion is clicked', async () => { const button = wrapper - .findAll(GlDeprecatedButton) - .filter(b => b.text() === 'production') + .findAll(GlButton) + .filter((b) => b.text() === 'production') .at(0); button.vm.$emit('click'); await wrapper.vm.$nextTick(); @@ -110,7 +110,7 @@ describe('Feature flags > Environments dropdown ', () => { describe('on click clear button', () => { beforeEach(async () => { - wrapper.find(GlDeprecatedButton).vm.$emit('click'); + wrapper.find(GlButton).vm.$emit('click'); await wrapper.vm.$nextTick(); }); @@ -136,10 +136,7 @@ describe('Feature flags > Environments dropdown ', () => { }); it('emits create event', async () => { - wrapper - .findAll(GlDeprecatedButton) - .at(0) - .vm.$emit('click'); + wrapper.findAll(GlButton).at(0).vm.$emit('click'); await wrapper.vm.$nextTick(); expect(wrapper.emitted('createClicked')).toEqual([['production']]); }); diff --git a/spec/frontend/feature_flags/components/feature_flags_spec.js b/spec/frontend/feature_flags/components/feature_flags_spec.js index 3c1234fea94..8242d667d2e 100644 --- a/spec/frontend/feature_flags/components/feature_flags_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_spec.js @@ -85,7 +85,7 @@ describe('Feature flags', () => { describe('when limit exceeded', () => { const provideData = { ...mockData, featureFlagsLimitExceeded: true }; - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); @@ -101,11 +101,9 @@ describe('Feature flags', () => { it('shows a feature flags limit reached alert', () => { expect(limitAlert().exists()).toBe(true); - expect( - limitAlert() - .find(GlSprintf) - .attributes('message'), - ).toContain('Feature flags limit reached'); + expect(limitAlert().find(GlSprintf).attributes('message')).toContain( + 'Feature flags limit reached', + ); }); describe('when the alert is dismissed', () => { @@ -134,7 +132,7 @@ describe('Feature flags', () => { newUserListPath: null, }; - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); @@ -219,7 +217,7 @@ describe('Feature flags', () => { }); describe('with paginated feature flags', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .replyOnce(200, getRequestData, { @@ -299,7 +297,7 @@ describe('Feature flags', () => { }); describe('in user lists tab', () => { - beforeEach(done => { + beforeEach((done) => { factory(); setImmediate(done); }); @@ -319,7 +317,7 @@ describe('Feature flags', () => { }); describe('unsuccessful request', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .replyOnce(500, {}); @@ -352,7 +350,7 @@ describe('Feature flags', () => { }); describe('rotate instance id', () => { - beforeEach(done => { + beforeEach((done) => { mock .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .reply(200, getRequestData, {}); diff --git a/spec/frontend/feature_flags/components/feature_flags_table_spec.js b/spec/frontend/feature_flags/components/feature_flags_table_spec.js index a488662470e..8881cfae88d 100644 --- a/spec/frontend/feature_flags/components/feature_flags_table_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_table_spec.js @@ -120,13 +120,11 @@ describe('Feature flag table', () => { describe('when active and with an update toggle', () => { let toggle; - let spy; beforeEach(() => { props.featureFlags[0].update_path = props.featureFlags[0].destroy_path; createWrapper(props); toggle = wrapper.find(GlToggle); - spy = mockTracking('_category_', toggle.element, jest.spyOn); }); it('should have a toggle', () => { @@ -142,14 +140,6 @@ describe('Feature flag table', () => { expect(wrapper.emitted('toggle-flag')).toEqual([[flag]]); }); }); - - it('should track a click', () => { - toggle.trigger('click'); - - expect(spy).toHaveBeenCalledWith('_category_', 'click_button', { - label: 'feature_flag_toggle', - }); - }); }); describe('with an active scope and a percentage rollout strategy', () => { @@ -180,6 +170,8 @@ describe('Feature flag table', () => { }); describe('with a new version flag', () => { + let toggle; + let spy; let badges; beforeEach(() => { @@ -194,6 +186,7 @@ describe('Feature flag table', () => { description: 'flag description', destroy_path: 'destroy/path', edit_path: 'edit/path', + update_path: 'update/path', version: NEW_VERSION_FLAG, scopes: [], strategies: [ @@ -226,6 +219,8 @@ describe('Feature flag table', () => { provide: { csrfToken: 'fakeToken', glFeatures: { featureFlagsNewVersion: true } }, }); + toggle = wrapper.find(GlToggle); + spy = mockTracking('_category_', toggle.element, jest.spyOn); badges = wrapper.findAll('[data-testid="strategy-badge"]'); }); @@ -254,6 +249,14 @@ describe('Feature flag table', () => { it('shows the name of a user list for user list', () => { expect(badges.at(3).text()).toContain('User List - test list'); }); + + it('tracks a click', () => { + toggle.trigger('click'); + + expect(spy).toHaveBeenCalledWith('_category_', 'click_button', { + label: 'feature_flag_toggle', + }); + }); }); it('renders a feature flag without an iid', () => { diff --git a/spec/frontend/feature_flags/components/form_spec.js b/spec/frontend/feature_flags/components/form_spec.js index 2c2a726d26f..3a057aedde9 100644 --- a/spec/frontend/feature_flags/components/form_spec.js +++ b/spec/frontend/feature_flags/components/form_spec.js @@ -118,7 +118,7 @@ describe('feature flag form', () => { }); }); - it('should be disabled if the feature flag is not active', done => { + it('should be disabled if the feature flag is not active', (done) => { wrapper.setProps({ active: false }); wrapper.vm.$nextTick(() => { expect(wrapper.find(ToggleButton).props('disabledInput')).toBe(true); @@ -191,7 +191,7 @@ describe('feature flag form', () => { expect(wrapper.vm.formScopes[0].active).toBe(false); }); - it('should be disabled if the feature flag is not active', done => { + it('should be disabled if the feature flag is not active', (done) => { wrapper.setProps({ active: false }); wrapper.vm.$nextTick(() => { @@ -301,7 +301,7 @@ describe('feature flag form', () => { }); describe('on submit', () => { - const selectFirstRolloutStrategyOption = dropdownIndex => { + const selectFirstRolloutStrategyOption = (dropdownIndex) => { wrapper .findAll('select.js-rollout-strategy') .at(dropdownIndex) @@ -347,10 +347,7 @@ describe('feature flag form', () => { return wrapper.vm.$nextTick(); }) .then(() => { - wrapper - .find('.js-add-new-scope') - .find(ToggleButton) - .vm.$emit('change', true); + wrapper.find('.js-add-new-scope').find(ToggleButton).vm.$emit('change', true); }) .then(() => { wrapper.find(ToggleButton).vm.$emit('change', true); diff --git a/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js b/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js index 12dc98fbde8..ad58ceaf5f8 100644 --- a/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js +++ b/spec/frontend/feature_flags/components/new_environments_dropdown_spec.js @@ -94,7 +94,7 @@ describe('New Environments Dropdown', () => { }); it('should not display a create label', () => { - items = items.filter(i => i.text().startsWith('Create')); + items = items.filter((i) => i.text().startsWith('Create')); expect(items).toHaveLength(0); }); diff --git a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js index b34fe7779e3..1c85eadc678 100644 --- a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js +++ b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js @@ -66,7 +66,7 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => { it('should search when the filter changes', async () => { let r; Api.searchFeatureFlagUserLists.mockReturnValue( - new Promise(resolve => { + new Promise((resolve) => { r = resolve; }), ); diff --git a/spec/frontend/feature_flags/components/strategy_parameters_spec.js b/spec/frontend/feature_flags/components/strategy_parameters_spec.js index a024384e623..82811c05195 100644 --- a/spec/frontend/feature_flags/components/strategy_parameters_spec.js +++ b/spec/frontend/feature_flags/components/strategy_parameters_spec.js @@ -51,7 +51,7 @@ describe('~/feature_flags/components/strategy_parameters.vue', () => { }); it('should show the correct component', () => { - expect(wrapper.contains(component)).toBe(true); + expect(wrapper.find(component).exists()).toBe(true); }); it('should emit changes from the lower component', () => { diff --git a/spec/frontend/feature_flags/components/user_lists_table_spec.js b/spec/frontend/feature_flags/components/user_lists_table_spec.js index d6ced3be168..974f63ba934 100644 --- a/spec/frontend/feature_flags/components/user_lists_table_spec.js +++ b/spec/frontend/feature_flags/components/user_lists_table_spec.js @@ -42,7 +42,7 @@ describe('User Lists Table', () => { it('should display a user list entry per user list', () => { const lists = wrapper.findAll('[data-testid="ffUserList"]'); expect(lists).toHaveLength(5); - lists.wrappers.forEach(list => { + lists.wrappers.forEach((list) => { expect(list.find('[data-testid="ffUserListName"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListIds"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListTimestamp"]').exists()).toBe(true); diff --git a/spec/frontend/feature_flags/store/edit/actions_spec.js b/spec/frontend/feature_flags/store/edit/actions_spec.js index 9d764799d09..20cec5daac0 100644 --- a/spec/frontend/feature_flags/store/edit/actions_spec.js +++ b/spec/frontend/feature_flags/store/edit/actions_spec.js @@ -44,7 +44,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', done => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', (done) => { const featureFlag = { name: 'feature_flag', description: 'feature flag', @@ -80,7 +80,7 @@ describe('Feature flags Edit Module actions', () => { done, ); }); - it('handles new version flags as well', done => { + it('handles new version flags as well', (done) => { const featureFlag = { name: 'name', description: 'description', @@ -117,7 +117,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('error', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', done => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { mock.onPut(`${TEST_HOST}/endpoint.json`).replyOnce(500, { message: [] }); testAction( @@ -145,7 +145,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('requestUpdateFeatureFlag', () => { - it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', (done) => { testAction( requestUpdateFeatureFlag, null, @@ -158,7 +158,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveUpdateFeatureFlagSuccess', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveUpdateFeatureFlagSuccess, null, @@ -175,7 +175,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveUpdateFeatureFlagError', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveUpdateFeatureFlagError, 'There was an error', @@ -200,7 +200,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', done => { + it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 1 }); testAction( @@ -223,7 +223,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('error', () => { - it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', done => { + it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -246,7 +246,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('requestFeatureFlag', () => { - it('should commit REQUEST_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_FEATURE_FLAG mutation', (done) => { testAction( requestFeatureFlag, null, @@ -259,7 +259,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveFeatureFlagSuccess', () => { - it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveFeatureFlagSuccess, { id: 1 }, @@ -272,7 +272,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('receiveFeatureFlagError', () => { - it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveFeatureFlagError, null, @@ -289,7 +289,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('toggelActive', () => { - it('should commit TOGGLE_ACTIVE mutation', done => { + it('should commit TOGGLE_ACTIVE mutation', (done) => { testAction( toggleActive, true, diff --git a/spec/frontend/feature_flags/store/index/actions_spec.js b/spec/frontend/feature_flags/store/index/actions_spec.js index d223bb2c292..82e16958d33 100644 --- a/spec/frontend/feature_flags/store/index/actions_spec.js +++ b/spec/frontend/feature_flags/store/index/actions_spec.js @@ -40,7 +40,7 @@ describe('Feature flags actions', () => { }); describe('setFeatureFlagsOptions', () => { - it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', done => { + it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', (done) => { testAction( setFeatureFlagsOptions, { page: '1', scope: 'all' }, @@ -65,7 +65,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', done => { + it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {}); testAction( @@ -88,7 +88,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', done => { + it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -111,7 +111,7 @@ describe('Feature flags actions', () => { }); describe('requestFeatureFlags', () => { - it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => { testAction( requestFeatureFlags, null, @@ -124,7 +124,7 @@ describe('Feature flags actions', () => { }); describe('receiveFeatureFlagsSuccess', () => { - it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => { testAction( receiveFeatureFlagsSuccess, { data: getRequestData, headers: {} }, @@ -142,7 +142,7 @@ describe('Feature flags actions', () => { }); describe('receiveFeatureFlagsError', () => { - it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', done => { + it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', (done) => { testAction( receiveFeatureFlagsError, null, @@ -160,7 +160,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestUserLists and receiveUserListsSuccess ', done => { + it('dispatches requestUserLists and receiveUserListsSuccess ', (done) => { testAction( fetchUserLists, null, @@ -181,7 +181,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestUserLists and receiveUserListsError ', done => { + it('dispatches requestUserLists and receiveUserListsError ', (done) => { Api.fetchFeatureFlagUserLists.mockRejectedValue(); testAction( @@ -204,7 +204,7 @@ describe('Feature flags actions', () => { }); describe('requestUserLists', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { testAction( requestUserLists, null, @@ -217,7 +217,7 @@ describe('Feature flags actions', () => { }); describe('receiveUserListsSuccess', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { testAction( receiveUserListsSuccess, { data: [userList], headers: {} }, @@ -235,7 +235,7 @@ describe('Feature flags actions', () => { }); describe('receiveUserListsError', () => { - it('should commit RECEIVE_USER_LISTS_ERROR mutation', done => { + it('should commit RECEIVE_USER_LISTS_ERROR mutation', (done) => { testAction( receiveUserListsError, null, @@ -260,7 +260,7 @@ describe('Feature flags actions', () => { }); describe('success', () => { - it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', done => { + it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', (done) => { mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {}); testAction( @@ -283,7 +283,7 @@ describe('Feature flags actions', () => { }); describe('error', () => { - it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', done => { + it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', (done) => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); testAction( @@ -306,7 +306,7 @@ describe('Feature flags actions', () => { }); describe('requestRotateInstanceId', () => { - it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', done => { + it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', (done) => { testAction( requestRotateInstanceId, null, @@ -319,7 +319,7 @@ describe('Feature flags actions', () => { }); describe('receiveRotateInstanceIdSuccess', () => { - it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', done => { + it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', (done) => { testAction( receiveRotateInstanceIdSuccess, { data: rotateData, headers: {} }, @@ -337,7 +337,7 @@ describe('Feature flags actions', () => { }); describe('receiveRotateInstanceIdError', () => { - it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', done => { + it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', (done) => { testAction( receiveRotateInstanceIdError, null, @@ -353,7 +353,7 @@ describe('Feature flags actions', () => { let mock; beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(flag => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -364,7 +364,7 @@ describe('Feature flags actions', () => { mock.restore(); }); describe('success', () => { - it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { + it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => { mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {}); testAction( @@ -387,7 +387,7 @@ describe('Feature flags actions', () => { }); }); describe('error', () => { - it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { + it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => { mock.onPut(featureFlag.update_path).replyOnce(500); testAction( @@ -412,13 +412,13 @@ describe('Feature flags actions', () => { }); describe('updateFeatureFlag', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits UPDATE_FEATURE_FLAG with the given flag', done => { + it('commits UPDATE_FEATURE_FLAG with the given flag', (done) => { testAction( updateFeatureFlag, featureFlag, @@ -436,13 +436,13 @@ describe('Feature flags actions', () => { }); describe('receiveUpdateFeatureFlagSuccess', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', done => { + it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', (done) => { testAction( receiveUpdateFeatureFlagSuccess, featureFlag, @@ -460,13 +460,13 @@ describe('Feature flags actions', () => { }); describe('receiveUpdateFeatureFlagError', () => { beforeEach(() => { - mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ + mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({ ...f, scopes: mapToScopesViewModel(f.scopes || []), })); }); - it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', done => { + it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', (done) => { testAction( receiveUpdateFeatureFlagError, featureFlag.id, @@ -492,7 +492,7 @@ describe('Feature flags actions', () => { Api.deleteFeatureFlagUserList.mockResolvedValue(); }); - it('should refresh the user lists', done => { + it('should refresh the user lists', (done) => { testAction( deleteUserList, userList, @@ -509,7 +509,7 @@ describe('Feature flags actions', () => { Api.deleteFeatureFlagUserList.mockRejectedValue({ response: { data: 'some error' } }); }); - it('should dispatch receiveDeleteUserListError', done => { + it('should dispatch receiveDeleteUserListError', (done) => { testAction( deleteUserList, userList, @@ -529,7 +529,7 @@ describe('Feature flags actions', () => { }); describe('receiveDeleteUserListError', () => { - it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', done => { + it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', (done) => { testAction( receiveDeleteUserListError, { list: userList, error: 'mock error' }, @@ -547,7 +547,7 @@ describe('Feature flags actions', () => { }); describe('clearAlert', () => { - it('should commit RECEIVE_CLEAR_ALERT', done => { + it('should commit RECEIVE_CLEAR_ALERT', (done) => { const alertIndex = 3; testAction( diff --git a/spec/frontend/feature_flags/store/index/mutations_spec.js b/spec/frontend/feature_flags/store/index/mutations_spec.js index 376c7b069fa..eec56800a8d 100644 --- a/spec/frontend/feature_flags/store/index/mutations_spec.js +++ b/spec/frontend/feature_flags/store/index/mutations_spec.js @@ -50,7 +50,7 @@ describe('Feature flags store Mutations', () => { }); it('should set featureFlags with the transformed data', () => { - const expected = getRequestData.feature_flags.map(flag => ({ + const expected = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -183,7 +183,7 @@ describe('Feature flags store Mutations', () => { describe('UPDATE_FEATURE_FLAG', () => { beforeEach(() => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); @@ -209,7 +209,7 @@ describe('Feature flags store Mutations', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS', () => { const runUpdate = (stateCount, flagState, featureFlagUpdateParams) => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, ...flagState, scopes: mapToScopesViewModel(flag.scopes || []), @@ -237,7 +237,7 @@ describe('Feature flags store Mutations', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_ERROR', () => { beforeEach(() => { - stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ + stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({ ...flag, scopes: mapToScopesViewModel(flag.scopes || []), })); diff --git a/spec/frontend/feature_flags/store/new/actions_spec.js b/spec/frontend/feature_flags/store/new/actions_spec.js index 130c5235aa0..9168f11fdfb 100644 --- a/spec/frontend/feature_flags/store/new/actions_spec.js +++ b/spec/frontend/feature_flags/store/new/actions_spec.js @@ -59,7 +59,7 @@ describe('Feature flags New Module Actions', () => { }); describe('success', () => { - it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', done => { + it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', (done) => { const convertedActionParams = mapFromScopesViewModel(actionParams); mock.onPost(`${TEST_HOST}/endpoint.json`, convertedActionParams).replyOnce(200); @@ -81,7 +81,7 @@ describe('Feature flags New Module Actions', () => { ); }); - it('sends strategies for new style feature flags', done => { + it('sends strategies for new style feature flags', (done) => { const newVersionFlagParams = { name: 'name', description: 'description', @@ -120,7 +120,7 @@ describe('Feature flags New Module Actions', () => { }); describe('error', () => { - it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', done => { + it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', (done) => { const convertedActionParams = mapFromScopesViewModel(actionParams); mock @@ -148,7 +148,7 @@ describe('Feature flags New Module Actions', () => { }); describe('requestCreateFeatureFlag', () => { - it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', done => { + it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', (done) => { testAction( requestCreateFeatureFlag, null, @@ -161,7 +161,7 @@ describe('Feature flags New Module Actions', () => { }); describe('receiveCreateFeatureFlagSuccess', () => { - it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', done => { + it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', (done) => { testAction( receiveCreateFeatureFlagSuccess, null, @@ -178,7 +178,7 @@ describe('Feature flags New Module Actions', () => { }); describe('receiveCreateFeatureFlagError', () => { - it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', done => { + it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', (done) => { testAction( receiveCreateFeatureFlagError, 'There was an error', |