Commit 4914a729 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 14 files - 3 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 792e3493
...@@ -10,22 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -10,22 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss *.scss
*.md *.md
## objective-swirles
spec/frontend/boards/components/sidebar/board_sidebar_labels_select_spec.js
spec/frontend/clusters/stores/clusters_store_spec.js
spec/frontend/diffs/components/diff_file_header_spec.js
spec/frontend/diffs/components/hidden_files_warning_spec.js
spec/frontend/environments/environment_monitoring_spec.js
spec/frontend/import_entities/import_groups/graphql/services/status_poller_spec.js
spec/frontend/issuable/related_issues/components/add_issuable_form_spec.js
spec/frontend/notes/components/discussion_filter_spec.js
spec/frontend/pipeline_editor/components/lint/ci_lint_results_spec.js
spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
spec/frontend/snippets/components/edit_spec.js
spec/frontend/user_lists/store/show/mutations_spec.js
spec/frontend/vue_shared/components/stacked_progress_bar_spec.js
spec/frontend_integration/ide/helpers/ide_helper.js
## boring-bohr ## boring-bohr
jest.config.base.js jest.config.base.js
jest.config.js jest.config.js
......
...@@ -10,8 +10,8 @@ import createFlash from '~/flash'; ...@@ -10,8 +10,8 @@ import createFlash from '~/flash';
jest.mock('~/flash'); jest.mock('~/flash');
const TEST_LABELS_PAYLOAD = TEST_LABELS.map(label => ({ ...label, set: true })); const TEST_LABELS_PAYLOAD = TEST_LABELS.map((label) => ({ ...label, set: true }));
const TEST_LABELS_TITLES = TEST_LABELS.map(label => label.title); const TEST_LABELS_TITLES = TEST_LABELS.map((label) => label.title);
describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => { describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => {
let wrapper; let wrapper;
...@@ -44,7 +44,8 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => { ...@@ -44,7 +44,8 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => {
}; };
const findLabelsSelect = () => wrapper.find({ ref: 'labelsSelect' }); const findLabelsSelect = () => wrapper.find({ ref: 'labelsSelect' });
const findLabelsTitles = () => wrapper.findAll(GlLabel).wrappers.map(item => item.props('title')); const findLabelsTitles = () =>
wrapper.findAll(GlLabel).wrappers.map((item) => item.props('title'));
const findCollapsed = () => wrapper.find('[data-testid="collapsed-content"]'); const findCollapsed = () => wrapper.find('[data-testid="collapsed-content"]');
it('renders "None" when no labels are selected', () => { it('renders "None" when no labels are selected', () => {
...@@ -76,7 +77,7 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => { ...@@ -76,7 +77,7 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => {
it('commits change to the server', () => { it('commits change to the server', () => {
expect(wrapper.vm.setActiveIssueLabels).toHaveBeenCalledWith({ expect(wrapper.vm.setActiveIssueLabels).toHaveBeenCalledWith({
addLabelIds: TEST_LABELS.map(label => label.id), addLabelIds: TEST_LABELS.map((label) => label.id),
projectPath: 'gitlab-org/test-subgroup/gitlab-test', projectPath: 'gitlab-org/test-subgroup/gitlab-test',
removeLabelIds: [], removeLabelIds: [],
}); });
......
...@@ -237,7 +237,9 @@ describe('Clusters Store', () => { ...@@ -237,7 +237,9 @@ describe('Clusters Store', () => {
}); });
}); });
describe.each(APPLICATION_INSTALLED_STATUSES)('given the current app status is %s', status => { describe.each(APPLICATION_INSTALLED_STATUSES)(
'given the current app status is %s',
(status) => {
it('marks application as installed', () => { it('marks application as installed', () => {
const mockResponseData = const mockResponseData =
CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data; CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data;
...@@ -249,7 +251,8 @@ describe('Clusters Store', () => { ...@@ -249,7 +251,8 @@ describe('Clusters Store', () => {
expect(store.state.applications[RUNNER].installed).toBe(true); expect(store.state.applications[RUNNER].installed).toBe(true);
}); });
}); },
);
it('sets default hostname for jupyter when ingress has a ip address', () => { it('sets default hostname for jupyter when ingress has a ip address', () => {
const mockResponseData = const mockResponseData =
......
...@@ -62,7 +62,7 @@ describe('DiffFileHeader component', () => { ...@@ -62,7 +62,7 @@ describe('DiffFileHeader component', () => {
diffHasDiscussionsResultMock, diffHasDiscussionsResultMock,
diffHasExpandedDiscussionsResultMock, diffHasExpandedDiscussionsResultMock,
...Object.values(mockStoreConfig.modules.diffs.actions), ...Object.values(mockStoreConfig.modules.diffs.actions),
].forEach(mock => mock.mockReset()); ].forEach((mock) => mock.mockReset());
wrapper.destroy(); wrapper.destroy();
}); });
...@@ -80,7 +80,7 @@ describe('DiffFileHeader component', () => { ...@@ -80,7 +80,7 @@ describe('DiffFileHeader component', () => {
const findCollapseIcon = () => wrapper.find({ ref: 'collapseIcon' }); const findCollapseIcon = () => wrapper.find({ ref: 'collapseIcon' });
const findEditButton = () => wrapper.find({ ref: 'editButton' }); const findEditButton = () => wrapper.find({ ref: 'editButton' });
const createComponent = props => { const createComponent = (props) => {
mockStoreConfig = cloneDeep(defaultMockStoreConfig); mockStoreConfig = cloneDeep(defaultMockStoreConfig);
const store = new Vuex.Store(mockStoreConfig); const store = new Vuex.Store(mockStoreConfig);
...@@ -219,7 +219,7 @@ describe('DiffFileHeader component', () => { ...@@ -219,7 +219,7 @@ describe('DiffFileHeader component', () => {
}); });
describe('for any file', () => { describe('for any file', () => {
const otherModes = Object.keys(diffViewerModes).filter(m => m !== 'mode_changed'); const otherModes = Object.keys(diffViewerModes).filter((m) => m !== 'mode_changed');
it('for mode_changed file mode displays mode changes', () => { it('for mode_changed file mode displays mode changes', () => {
createComponent({ createComponent({
...@@ -236,7 +236,9 @@ describe('DiffFileHeader component', () => { ...@@ -236,7 +236,9 @@ describe('DiffFileHeader component', () => {
expect(findModeChangedLine().text()).toMatch(/old-mode.+new-mode/); expect(findModeChangedLine().text()).toMatch(/old-mode.+new-mode/);
}); });
it.each(otherModes.map(m => [m]))('for %s file mode does not display mode changes', mode => { it.each(otherModes.map((m) => [m]))(
'for %s file mode does not display mode changes',
(mode) => {
createComponent({ createComponent({
diffFile: { diffFile: {
...diffFile, ...diffFile,
...@@ -249,7 +251,8 @@ describe('DiffFileHeader component', () => { ...@@ -249,7 +251,8 @@ describe('DiffFileHeader component', () => {
}, },
}); });
expect(findModeChangedLine().exists()).toBeFalsy(); expect(findModeChangedLine().exists()).toBeFalsy();
}); },
);
it('displays the LFS label for files stored in LFS', () => { it('displays the LFS label for files stored in LFS', () => {
createComponent({ createComponent({
......
...@@ -26,13 +26,15 @@ describe('HiddenFilesWarning', () => { ...@@ -26,13 +26,15 @@ describe('HiddenFilesWarning', () => {
}); });
it('has a correct plain diff URL', () => { it('has a correct plain diff URL', () => {
const plainDiffLink = wrapper.findAll('a').wrappers.filter(x => x.text() === 'Plain diff')[0]; const plainDiffLink = wrapper.findAll('a').wrappers.filter((x) => x.text() === 'Plain diff')[0];
expect(plainDiffLink.attributes('href')).toBe(propsData.plainDiffPath); expect(plainDiffLink.attributes('href')).toBe(propsData.plainDiffPath);
}); });
it('has a correct email patch URL', () => { it('has a correct email patch URL', () => {
const emailPatchLink = wrapper.findAll('a').wrappers.filter(x => x.text() === 'Email patch')[0]; const emailPatchLink = wrapper
.findAll('a')
.wrappers.filter((x) => x.text() === 'Email patch')[0];
expect(emailPatchLink.attributes('href')).toBe(propsData.emailPatchPath); expect(emailPatchLink.attributes('href')).toBe(propsData.emailPatchPath);
}); });
......
...@@ -16,7 +16,8 @@ describe('Monitoring Component', () => { ...@@ -16,7 +16,8 @@ describe('Monitoring Component', () => {
}; };
const findButtons = () => wrapper.findAll(GlButton); const findButtons = () => wrapper.findAll(GlButton);
const findButtonsByIcon = icon => findButtons().filter(button => button.props('icon') === icon); const findButtonsByIcon = (icon) =>
findButtons().filter((button) => button.props('icon') === icon);
beforeEach(() => { beforeEach(() => {
createWrapper(); createWrapper();
......
...@@ -23,7 +23,7 @@ describe('Bulk import status poller', () => { ...@@ -23,7 +23,7 @@ describe('Bulk import status poller', () => {
let clientMock; let clientMock;
const listQueryCacheCalls = () => const listQueryCacheCalls = () =>
clientMock.readQuery.mock.calls.filter(call => call[0].query === bulkImportSourceGroupsQuery); clientMock.readQuery.mock.calls.filter((call) => call[0].query === bulkImportSourceGroupsQuery);
beforeEach(() => { beforeEach(() => {
clientMock = createMockClient({ clientMock = createMockClient({
...@@ -142,9 +142,11 @@ describe('Bulk import status poller', () => { ...@@ -142,9 +142,11 @@ describe('Bulk import status poller', () => {
clientMock.cache.writeQuery({ clientMock.cache.writeQuery({
query: bulkImportSourceGroupsQuery, query: bulkImportSourceGroupsQuery,
data: { data: {
bulkImportSourceGroups: [STARTED_GROUP_1, NOT_STARTED_GROUP, STARTED_GROUP_2].map(group => bulkImportSourceGroups: [
generateFakeEntry(group), STARTED_GROUP_1,
), NOT_STARTED_GROUP,
STARTED_GROUP_2,
].map((group) => generateFakeEntry(group)),
}, },
}); });
...@@ -155,9 +157,9 @@ describe('Bulk import status poller', () => { ...@@ -155,9 +157,9 @@ describe('Bulk import status poller', () => {
await waitForPromises(); await waitForPromises();
const [[doc]] = clientMock.query.mock.calls; const [[doc]] = clientMock.query.mock.calls;
const { selections } = doc.query.definitions[0].selectionSet; const { selections } = doc.query.definitions[0].selectionSet;
expect(selections.every(field => field.name.value === 'group')).toBeTruthy(); expect(selections.every((field) => field.name.value === 'group')).toBeTruthy();
expect(selections).toHaveLength(2); expect(selections).toHaveLength(2);
expect(selections.map(sel => sel.arguments[0].value.value)).toStrictEqual([ expect(selections.map((sel) => sel.arguments[0].value.value)).toStrictEqual([
`${TARGET_NAMESPACE}/${STARTED_GROUP_1.import_target.new_name}`, `${TARGET_NAMESPACE}/${STARTED_GROUP_1.import_target.new_name}`,
`${TARGET_NAMESPACE}/${STARTED_GROUP_2.import_target.new_name}`, `${TARGET_NAMESPACE}/${STARTED_GROUP_2.import_target.new_name}`,
]); ]);
...@@ -167,7 +169,7 @@ describe('Bulk import status poller', () => { ...@@ -167,7 +169,7 @@ describe('Bulk import status poller', () => {
clientMock.cache.writeQuery({ clientMock.cache.writeQuery({
query: bulkImportSourceGroupsQuery, query: bulkImportSourceGroupsQuery,
data: { data: {
bulkImportSourceGroups: [STARTED_GROUP_1, STARTED_GROUP_2].map(group => bulkImportSourceGroups: [STARTED_GROUP_1, STARTED_GROUP_2].map((group) =>
generateFakeEntry(group), generateFakeEntry(group),
), ),
}, },
...@@ -189,7 +191,7 @@ describe('Bulk import status poller', () => { ...@@ -189,7 +191,7 @@ describe('Bulk import status poller', () => {
clientMock.cache.writeQuery({ clientMock.cache.writeQuery({
query: bulkImportSourceGroupsQuery, query: bulkImportSourceGroupsQuery,
data: { data: {
bulkImportSourceGroups: [STARTED_GROUP_1, STARTED_GROUP_2].map(group => bulkImportSourceGroups: [STARTED_GROUP_1, STARTED_GROUP_2].map((group) =>
generateFakeEntry(group), generateFakeEntry(group),
), ),
}, },
......
...@@ -22,13 +22,14 @@ const issuable2 = { ...@@ -22,13 +22,14 @@ const issuable2 = {
const pathIdSeparator = PathIdSeparator.Issue; const pathIdSeparator = PathIdSeparator.Issue;
const findFormInput = wrapper => wrapper.find('.js-add-issuable-form-input').element; const findFormInput = (wrapper) => wrapper.find('.js-add-issuable-form-input').element;
const findRadioInput = (inputs, value) => inputs.filter(input => input.element.value === value)[0]; const findRadioInput = (inputs, value) =>
inputs.filter((input) => input.element.value === value)[0];
const findRadioInputs = wrapper => wrapper.findAll('[name="linked-issue-type-radio"]'); const findRadioInputs = (wrapper) => wrapper.findAll('[name="linked-issue-type-radio"]');
const constructWrapper = props => { const constructWrapper = (props) => {
return shallowMount(AddIssuableForm, { return shallowMount(AddIssuableForm, {
propsData: { propsData: {
inputValue: '', inputValue: '',
...@@ -192,7 +193,7 @@ describe('AddIssuableForm', () => { ...@@ -192,7 +193,7 @@ describe('AddIssuableForm', () => {
}); });
describe('when the form is submitted', () => { describe('when the form is submitted', () => {
it('emits an event with a "relates_to" link type when the "relates to" radio input selected', done => { it('emits an event with a "relates_to" link type when the "relates to" radio input selected', (done) => {
jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {}); jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {});
wrapper.vm.linkedIssueType = linkedIssueTypesMap.RELATES_TO; wrapper.vm.linkedIssueType = linkedIssueTypesMap.RELATES_TO;
...@@ -207,7 +208,7 @@ describe('AddIssuableForm', () => { ...@@ -207,7 +208,7 @@ describe('AddIssuableForm', () => {
}); });
}); });
it('emits an event with a "blocks" link type when the "blocks" radio input selected', done => { it('emits an event with a "blocks" link type when the "blocks" radio input selected', (done) => {
jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {}); jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {});
wrapper.vm.linkedIssueType = linkedIssueTypesMap.BLOCKS; wrapper.vm.linkedIssueType = linkedIssueTypesMap.BLOCKS;
...@@ -222,7 +223,7 @@ describe('AddIssuableForm', () => { ...@@ -222,7 +223,7 @@ describe('AddIssuableForm', () => {
}); });
}); });
it('emits an event with a "is_blocked_by" link type when the "is blocked by" radio input selected', done => { it('emits an event with a "is_blocked_by" link type when the "is blocked by" radio input selected', (done) => {
jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {}); jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {});
wrapper.vm.linkedIssueType = linkedIssueTypesMap.IS_BLOCKED_BY; wrapper.vm.linkedIssueType = linkedIssueTypesMap.IS_BLOCKED_BY;
...@@ -237,7 +238,7 @@ describe('AddIssuableForm', () => { ...@@ -237,7 +238,7 @@ describe('AddIssuableForm', () => {
}); });
}); });
it('shows error message when error is present', done => { it('shows error message when error is present', (done) => {
const itemAddFailureMessage = 'Something went wrong while submitting.'; const itemAddFailureMessage = 'Something went wrong while submitting.';
wrapper.setProps({ wrapper.setProps({
hasError: true, hasError: true,
......
...@@ -25,7 +25,8 @@ describe('DiscussionFilter component', () => { ...@@ -25,7 +25,8 @@ describe('DiscussionFilter component', () => {
const filterDiscussion = jest.fn(); const filterDiscussion = jest.fn();
const findFilter = filterType => wrapper.find(`.dropdown-item[data-filter-type="${filterType}"]`); const findFilter = (filterType) =>
wrapper.find(`.dropdown-item[data-filter-type="${filterType}"]`);
const mountComponent = () => { const mountComponent = () => {
const discussions = [ const discussions = [
...@@ -145,7 +146,7 @@ describe('DiscussionFilter component', () => { ...@@ -145,7 +146,7 @@ describe('DiscussionFilter component', () => {
window.mrTabs = undefined; window.mrTabs = undefined;
}); });
it('only renders when discussion tab is active', done => { it('only renders when discussion tab is active', (done) => {
eventHub.$emit('MergeRequestTabChange', 'commit'); eventHub.$emit('MergeRequestTabChange', 'commit');
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
...@@ -160,7 +161,7 @@ describe('DiscussionFilter component', () => { ...@@ -160,7 +161,7 @@ describe('DiscussionFilter component', () => {
window.location.hash = ''; window.location.hash = '';
}); });
it('updates the filter when the URL links to a note', done => { it('updates the filter when the URL links to a note', (done) => {
window.location.hash = `note_${discussionMock.notes[0].id}`; window.location.hash = `note_${discussionMock.notes[0].id}`;
wrapper.vm.currentValue = discussionFiltersMock[2].value; wrapper.vm.currentValue = discussionFiltersMock[2].value;
wrapper.vm.handleLocationHash(); wrapper.vm.handleLocationHash();
...@@ -171,7 +172,7 @@ describe('DiscussionFilter component', () => { ...@@ -171,7 +172,7 @@ describe('DiscussionFilter component', () => {
}); });
}); });
it('does not update the filter when the current filter is "Show all activity"', done => { it('does not update the filter when the current filter is "Show all activity"', (done) => {
window.location.hash = `note_${discussionMock.notes[0].id}`; window.location.hash = `note_${discussionMock.notes[0].id}`;
wrapper.vm.handleLocationHash(); wrapper.vm.handleLocationHash();
...@@ -181,7 +182,7 @@ describe('DiscussionFilter component', () => { ...@@ -181,7 +182,7 @@ describe('DiscussionFilter component', () => {
}); });
}); });
it('only updates filter when the URL links to a note', done => { it('only updates filter when the URL links to a note', (done) => {
window.location.hash = `testing123`; window.location.hash = `testing123`;
wrapper.vm.handleLocationHash(); wrapper.vm.handleLocationHash();
...@@ -191,7 +192,7 @@ describe('DiscussionFilter component', () => { ...@@ -191,7 +192,7 @@ describe('DiscussionFilter component', () => {
}); });
}); });
it('fetches discussions when there is a hash', done => { it('fetches discussions when there is a hash', (done) => {
window.location.hash = `note_${discussionMock.notes[0].id}`; window.location.hash = `note_${discussionMock.notes[0].id}`;
wrapper.vm.currentValue = discussionFiltersMock[2].value; wrapper.vm.currentValue = discussionFiltersMock[2].value;
jest.spyOn(wrapper.vm, 'selectFilter').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'selectFilter').mockImplementation(() => {});
...@@ -203,7 +204,7 @@ describe('DiscussionFilter component', () => { ...@@ -203,7 +204,7 @@ describe('DiscussionFilter component', () => {
}); });
}); });
it('does not fetch discussions when there is no hash', done => { it('does not fetch discussions when there is no hash', (done) => {
window.location.hash = ''; window.location.hash = '';
jest.spyOn(wrapper.vm, 'selectFilter').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'selectFilter').mockImplementation(() => {});
wrapper.vm.handleLocationHash(); wrapper.vm.handleLocationHash();
......
...@@ -25,8 +25,9 @@ describe('CI Lint Results', () => { ...@@ -25,8 +25,9 @@ describe('CI Lint Results', () => {
}; };
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findByTestId = selector => () => wrapper.find(`[data-testid="ci-lint-${selector}"]`); const findByTestId = (selector) => () => wrapper.find(`[data-testid="ci-lint-${selector}"]`);
const findAllByTestId = selector => () => wrapper.findAll(`[data-testid="ci-lint-${selector}"]`); const findAllByTestId = (selector) => () =>
wrapper.findAll(`[data-testid="ci-lint-${selector}"]`);
const findLinkToDoc = () => wrapper.find(GlLink); const findLinkToDoc = () => wrapper.find(GlLink);
const findErrors = findByTestId('errors'); const findErrors = findByTestId('errors');
const findWarnings = findByTestId('warnings'); const findWarnings = findByTestId('warnings');
...@@ -37,7 +38,7 @@ describe('CI Lint Results', () => { ...@@ -37,7 +38,7 @@ describe('CI Lint Results', () => {
const findBeforeScripts = findAllByTestId('before-script'); const findBeforeScripts = findAllByTestId('before-script');
const findScripts = findAllByTestId('script'); const findScripts = findAllByTestId('script');
const findAfterScripts = findAllByTestId('after-script'); const findAfterScripts = findAllByTestId('after-script');
const filterEmptyScripts = property => mockJobs.filter(job => job[property].length !== 0); const filterEmptyScripts = (property) => mockJobs.filter((job) => job[property].length !== 0);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -185,7 +185,9 @@ describe('ServiceDeskSetting', () => { ...@@ -185,7 +185,9 @@ describe('ServiceDeskSetting', () => {
const expectedTemplates = [''].concat(templates); const expectedTemplates = [''].concat(templates);
const dropdown = findTemplateDropdown(); const dropdown = findTemplateDropdown();
const dropdownList = Array.from(dropdown.element.children).map(option => option.innerText); const dropdownList = Array.from(dropdown.element.children).map(
(option) => option.innerText,
);
expect(dropdown.element.children).toHaveLength(expectedTemplates.length); expect(dropdown.element.children).toHaveLength(expectedTemplates.length);
expect(dropdownList.includes('Bug')).toEqual(true); expect(dropdownList.includes('Bug')).toEqual(true);
......
...@@ -149,9 +149,11 @@ describe('Snippet Edit app', () => { ...@@ -149,9 +149,11 @@ describe('Snippet Edit app', () => {
const hasDisabledSubmit = () => Boolean(findSubmitButton().attributes('disabled')); const hasDisabledSubmit = () => Boolean(findSubmitButton().attributes('disabled'));
const clickSubmitBtn = () => wrapper.find('[data-testid="snippet-edit-form"]').trigger('submit'); const clickSubmitBtn = () => wrapper.find('[data-testid="snippet-edit-form"]').trigger('submit');
const triggerBlobActions = actions => findBlobActions().vm.$emit('actions', actions); const triggerBlobActions = (actions) => findBlobActions().vm.$emit('actions', actions);
const setUploadFilesHtml = paths => { const setUploadFilesHtml = (paths) => {
wrapper.vm.$el.innerHTML = paths.map(path => `<input name="files[]" value="${path}">`).join(''); wrapper.vm.$el.innerHTML = paths
.map((path) => `<input name="files[]" value="${path}">`)
.join('');
}; };
const getApiData = ({ const getApiData = ({
id, id,
...@@ -189,7 +191,7 @@ describe('Snippet Edit app', () => { ...@@ -189,7 +191,7 @@ describe('Snippet Edit app', () => {
it.each([[{}], [{ snippetGid: '' }]])( it.each([[{}], [{ snippetGid: '' }]])(
'should render all required components with %s', 'should render all required components with %s',
props => { (props) => {
createComponent(props); createComponent(props);
expect(wrapper.find(TitleField).exists()).toBe(true); expect(wrapper.find(TitleField).exists()).toBe(true);
...@@ -257,7 +259,7 @@ describe('Snippet Edit app', () => { ...@@ -257,7 +259,7 @@ describe('Snippet Edit app', () => {
describe('default visibility', () => { describe('default visibility', () => {
it.each([SNIPPET_VISIBILITY_PRIVATE, SNIPPET_VISIBILITY_INTERNAL, SNIPPET_VISIBILITY_PUBLIC])( it.each([SNIPPET_VISIBILITY_PRIVATE, SNIPPET_VISIBILITY_INTERNAL, SNIPPET_VISIBILITY_PUBLIC])(
'marks %s visibility by default', 'marks %s visibility by default',
async visibility => { async (visibility) => {
createComponent({ createComponent({
props: { snippetGid: '' }, props: { snippetGid: '' },
selectedLevel: visibility, selectedLevel: visibility,
......
...@@ -57,7 +57,7 @@ describe('User Lists Show Mutations', () => { ...@@ -57,7 +57,7 @@ describe('User Lists Show Mutations', () => {
}); });
it('adds the new IDs to the state unless empty', () => { it('adds the new IDs to the state unless empty', () => {
newIds.filter(id => id).forEach(id => expect(mockState.userIds).toContain(id)); newIds.filter((id) => id).forEach((id) => expect(mockState.userIds).toContain(id));
}); });
it('does not add duplicate IDs to the state', () => { it('does not add duplicate IDs to the state', () => {
...@@ -80,7 +80,9 @@ describe('User Lists Show Mutations', () => { ...@@ -80,7 +80,9 @@ describe('User Lists Show Mutations', () => {
}); });
it('should leave the rest of the IDs alone', () => { it('should leave the rest of the IDs alone', () => {
userIds.filter(id => id !== removedId).forEach(id => expect(mockState.userIds).toContain(id)); userIds
.filter((id) => id !== removedId)
.forEach((id) => expect(mockState.userIds).toContain(id));
}); });
}); });
}); });
...@@ -3,7 +3,7 @@ import Vue from 'vue'; ...@@ -3,7 +3,7 @@ import Vue from 'vue';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import stackedProgressBarComponent from '~/vue_shared/components/stacked_progress_bar.vue'; import stackedProgressBarComponent from '~/vue_shared/components/stacked_progress_bar.vue';
const createComponent = config => { const createComponent = (config) => {
const Component = Vue.extend(stackedProgressBarComponent); const Component = Vue.extend(stackedProgressBarComponent);
const defaultConfig = { const defaultConfig = {
successLabel: 'Synced', successLabel: 'Synced',
...@@ -29,11 +29,12 @@ describe('StackedProgressBarComponent', () => { ...@@ -29,11 +29,12 @@ describe('StackedProgressBarComponent', () => {
vm.$destroy(); vm.$destroy();
}); });
const findSuccessBarText = wrapper => wrapper.$el.querySelector('.status-green').innerText.trim(); const findSuccessBarText = (wrapper) =>
const findNeutralBarText = wrapper => wrapper.$el.querySelector('.status-green').innerText.trim();
const findNeutralBarText = (wrapper) =>
wrapper.$el.querySelector('.status-neutral').innerText.trim(); wrapper.$el.querySelector('.status-neutral').innerText.trim();
const findFailureBarText = wrapper => wrapper.$el.querySelector('.status-red').innerText.trim(); const findFailureBarText = (wrapper) => wrapper.$el.querySelector('.status-red').innerText.trim();
const findUnavailableBarText = wrapper => const findUnavailableBarText = (wrapper) =>
wrapper.$el.querySelector('.status-unavailable').innerText.trim(); wrapper.$el.querySelector('.status-unavailable').innerText.trim();
describe('computed', () => { describe('computed', () => {
......
...@@ -8,11 +8,11 @@ import { ...@@ -8,11 +8,11 @@ import {
findByText, findByText,
} from '@testing-library/dom'; } from '@testing-library/dom';
const isFolderRowOpen = row => row.matches('.folder.is-open'); const isFolderRowOpen = (row) => row.matches('.folder.is-open');
const getLeftSidebar = () => screen.getByTestId('left-sidebar'); const getLeftSidebar = () => screen.getByTestId('left-sidebar');
export const switchLeftSidebarTab = name => { export const switchLeftSidebarTab = (name) => {
const sidebar = getLeftSidebar(); const sidebar = getLeftSidebar();
const button = getByLabelText(sidebar, name); const button = getByLabelText(sidebar, name);
...@@ -23,7 +23,7 @@ export const switchLeftSidebarTab = name => { ...@@ -23,7 +23,7 @@ export const switchLeftSidebarTab = name => {
export const getStatusBar = () => document.querySelector('.ide-status-bar'); export const getStatusBar = () => document.querySelector('.ide-status-bar');
export const waitForMonacoEditor = () => export const waitForMonacoEditor = () =>
new Promise(resolve => window.monaco.editor.onDidCreateEditor(resolve)); new Promise((resolve) => window.monaco.editor.onDidCreateEditor(resolve));
export const findMonacoEditor = () => export const findMonacoEditor = () =>
screen.findAllByLabelText(/Editor content;/).then(([x]) => x.closest('.monaco-editor')); screen.findAllByLabelText(/Editor content;/).then(([x]) => x.closest('.monaco-editor'));
...@@ -31,7 +31,7 @@ export const findMonacoEditor = () => ...@@ -31,7 +31,7 @@ export const findMonacoEditor = () =>
export const findMonacoDiffEditor = () => export const findMonacoDiffEditor = () =>
screen.findAllByLabelText(/Editor content;/).then(([x]) => x.closest('.monaco-diff-editor')); screen.findAllByLabelText(/Editor content;/).then(([x]) => x.closest('.monaco-diff-editor'));
export const findAndSetEditorValue = async value => { export const findAndSetEditorValue = async (value) => {
const editor = await findMonacoEditor(); const editor = await findMonacoEditor();
const uri = editor.getAttribute('data-uri'); const uri = editor.getAttribute('data-uri');
...@@ -56,10 +56,12 @@ const findFileChild = async (row, name, index = 0) => { ...@@ -56,10 +56,12 @@ const findFileChild = async (row, name, index = 0) => {
const container = await findFileRowContainer(row); const container = await findFileRowContainer(row);
const children = await findAllByText(container, name, { selector: '.file-row-name' }); const children = await findAllByText(container, name, { selector: '.file-row-name' });
return children.map(x => x.closest('.file-row')).find(x => x.dataset.level === index.toString()); return children
.map((x) => x.closest('.file-row'))
.find((x) => x.dataset.level === index.toString());
}; };
const openFileRow = row => { const openFileRow = (row) => {
if (!row || isFolderRowOpen(row)) { if (!row || isFolderRowOpen(row)) {
return; return;
} }
...@@ -101,7 +103,7 @@ const fillFileNameModal = async (value, submitText = 'Create file') => { ...@@ -101,7 +103,7 @@ const fillFileNameModal = async (value, submitText = 'Create file') => {
createButton.click(); createButton.click();
}; };
const findAndClickRootAction = async name => { const findAndClickRootAction = async (name) => {
const container = await findRootActions(); const container = await findRootActions();
const button = getByLabelText(container, name); const button = getByLabelText(container, name);
...@@ -112,13 +114,13 @@ export const clickPreviewMarkdown = () => { ...@@ -112,13 +114,13 @@ export const clickPreviewMarkdown = () => {
screen.getByText('Preview Markdown').click(); screen.getByText('Preview Markdown').click();
}; };
export const openFile = async path => { export const openFile = async (path) => {
const row = await findAndTraverseToPath(path); const row = await findAndTraverseToPath(path);
openFileRow(row); openFileRow(row);
}; };
export const waitForTabToOpen = fileName => export const waitForTabToOpen = (fileName) =>
findByText(document.querySelector('.multi-file-edit-pane'), fileName); findByText(document.querySelector('.multi-file-edit-pane'), fileName);
export const createFile = async (path, content) => { export const createFile = async (path, content) => {
...@@ -137,10 +139,10 @@ export const createFile = async (path, content) => { ...@@ -137,10 +139,10 @@ export const createFile = async (path, content) => {
}; };
export const getFilesList = () => { export const getFilesList = () => {
return screen.getAllByTestId('file-row-name-container').map(e => e.textContent.trim()); return screen.getAllByTestId('file-row-name-container').map((e) => e.textContent.trim());
}; };
export const deleteFile = async path => { export const deleteFile = async (path) => {
const row = await findAndTraverseToPath(path); const row = await findAndTraverseToPath(path);
clickFileRowAction(row, 'Delete'); clickFileRowAction(row, 'Delete');
}; };
...@@ -152,7 +154,7 @@ export const renameFile = async (path, newPath) => { ...@@ -152,7 +154,7 @@ export const renameFile = async (path, newPath) => {
await fillFileNameModal(newPath, 'Rename file'); await fillFileNameModal(newPath, 'Rename file');
}; };
export const closeFile = async path => { export const closeFile = async (path) => {
const button = await screen.getByLabelText(`Close ${path}`, { const button = await screen.getByLabelText(`Close ${path}`, {
selector: '.multi-file-tabs button', selector: '.multi-file-tabs button',
}); });
...@@ -164,7 +166,7 @@ export const commit = async () => { ...@@ -164,7 +166,7 @@ export const commit = async () => {
switchLeftSidebarTab('Commit'); switchLeftSidebarTab('Commit');
screen.getByTestId('begin-commit-button').click(); screen.getByTestId('begin-commit-button').click();
await screen.findByLabelText(/Commit to .+ branch/).then(x => x.click()); await screen.findByLabelText(/Commit to .+ branch/).then((x) => x.click());
screen.getByText('Commit').click(); screen.getByText('Commit').click();
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment