Commit 86ce5406 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 spec files: 5 of 10

Mandatory not to break master. Automatically created with prettier.
parent da4eea76
...@@ -11,21 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -11,21 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md *.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively: # temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
spec/frontend/alert_management/components
spec/frontend/alerts_settings
spec/frontend/authentication/u2f
spec/frontend/badges/components
spec/frontend/badges/store
spec/frontend/batch_comments/components
spec/frontend/behaviors
spec/frontend/blob/components
spec/frontend/boards
spec/frontend/ci_settings_pipeline_triggers/components
spec/frontend/ci_variable_list/ci_variable_list
spec/frontend/create_cluster/components
spec/frontend/create_cluster/eks_cluster/services
spec/frontend/deploy_freeze/components
spec/frontend/deploy_keys/components
spec/frontend/design_management/components/design_notes spec/frontend/design_management/components/design_notes
spec/frontend/design_management/pages spec/frontend/design_management/pages
spec/frontend/diffs/components spec/frontend/diffs/components
......
...@@ -85,11 +85,7 @@ describe('AlertManagementTable', () => { ...@@ -85,11 +85,7 @@ describe('AlertManagementTable', () => {
}); });
expect(findAlertsTable().exists()).toBe(true); expect(findAlertsTable().exists()).toBe(true);
expect(findLoader().exists()).toBe(true); expect(findLoader().exists()).toBe(true);
expect( expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50');
findAlerts()
.at(0)
.classes(),
).not.toContain('gl-hover-bg-blue-50');
}); });
it('error state', () => { it('error state', () => {
...@@ -101,11 +97,7 @@ describe('AlertManagementTable', () => { ...@@ -101,11 +97,7 @@ describe('AlertManagementTable', () => {
expect(findAlertsTable().text()).toContain('No alerts to display'); expect(findAlertsTable().text()).toContain('No alerts to display');
expect(findLoader().exists()).toBe(false); expect(findLoader().exists()).toBe(false);
expect(findAlert().props().variant).toBe('danger'); expect(findAlert().props().variant).toBe('danger');
expect( expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50');
findAlerts()
.at(0)
.classes(),
).not.toContain('gl-hover-bg-blue-50');
}); });
it('empty state', () => { it('empty state', () => {
...@@ -125,11 +117,7 @@ describe('AlertManagementTable', () => { ...@@ -125,11 +117,7 @@ describe('AlertManagementTable', () => {
expect(findAlertsTable().text()).toContain('No alerts to display'); expect(findAlertsTable().text()).toContain('No alerts to display');
expect(findLoader().exists()).toBe(false); expect(findLoader().exists()).toBe(false);
expect(findAlert().props().variant).toBe('info'); expect(findAlert().props().variant).toBe('info');
expect( expect(findAlerts().at(0).classes()).not.toContain('gl-hover-bg-blue-50');
findAlerts()
.at(0)
.classes(),
).not.toContain('gl-hover-bg-blue-50');
}); });
it('has data state', () => { it('has data state', () => {
...@@ -140,11 +128,7 @@ describe('AlertManagementTable', () => { ...@@ -140,11 +128,7 @@ describe('AlertManagementTable', () => {
expect(findLoader().exists()).toBe(false); expect(findLoader().exists()).toBe(false);
expect(findAlertsTable().exists()).toBe(true); expect(findAlertsTable().exists()).toBe(true);
expect(findAlerts()).toHaveLength(mockAlerts.length); expect(findAlerts()).toHaveLength(mockAlerts.length);
expect( expect(findAlerts().at(0).classes()).toContain('gl-hover-bg-blue-50');
findAlerts()
.at(0)
.classes(),
).toContain('gl-hover-bg-blue-50');
}); });
it('displays the alert ID and title formatted correctly', () => { it('displays the alert ID and title formatted correctly', () => {
...@@ -170,11 +154,7 @@ describe('AlertManagementTable', () => { ...@@ -170,11 +154,7 @@ describe('AlertManagementTable', () => {
data: { alerts: { list: mockAlerts }, alertsCount, errored: false }, data: { alerts: { list: mockAlerts }, alertsCount, errored: false },
loading: false, loading: false,
}); });
expect( expect(findStatusDropdown().find('.dropdown-title').exists()).toBe(false);
findStatusDropdown()
.find('.dropdown-title')
.exists(),
).toBe(false);
}); });
it('shows correct severity icons', async () => { it('shows correct severity icons', async () => {
...@@ -186,11 +166,7 @@ describe('AlertManagementTable', () => { ...@@ -186,11 +166,7 @@ describe('AlertManagementTable', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(GlTable).exists()).toBe(true); expect(wrapper.find(GlTable).exists()).toBe(true);
expect( expect(findAlertsTable().find(GlIcon).classes('icon-critical')).toBe(true);
findAlertsTable()
.find(GlIcon)
.classes('icon-critical'),
).toBe(true);
}); });
it('renders severity text', () => { it('renders severity text', () => {
...@@ -199,11 +175,7 @@ describe('AlertManagementTable', () => { ...@@ -199,11 +175,7 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
expect( expect(findSeverityFields().at(0).text()).toBe('Critical');
findSeverityFields()
.at(0)
.text(),
).toBe('Critical');
}); });
it('renders Unassigned when no assignee(s) present', () => { it('renders Unassigned when no assignee(s) present', () => {
...@@ -212,11 +184,7 @@ describe('AlertManagementTable', () => { ...@@ -212,11 +184,7 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
expect( expect(findAssignees().at(0).text()).toBe('Unassigned');
findAssignees()
.at(0)
.text(),
).toBe('Unassigned');
}); });
it('renders user avatar when assignee present', () => { it('renders user avatar when assignee present', () => {
...@@ -225,9 +193,7 @@ describe('AlertManagementTable', () => { ...@@ -225,9 +193,7 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
const avatar = findAssignees() const avatar = findAssignees().at(1).find(GlAvatar);
.at(1)
.find(GlAvatar);
const { src, label } = avatar.attributes(); const { src, label } = avatar.attributes();
const { name, avatarUrl } = mockAlerts[1].assignees.nodes[0]; const { name, avatarUrl } = mockAlerts[1].assignees.nodes[0];
...@@ -244,9 +210,7 @@ describe('AlertManagementTable', () => { ...@@ -244,9 +210,7 @@ describe('AlertManagementTable', () => {
expect(visitUrl).not.toHaveBeenCalled(); expect(visitUrl).not.toHaveBeenCalled();
findAlerts() findAlerts().at(0).trigger('click');
.at(0)
.trigger('click');
expect(visitUrl).toHaveBeenCalledWith('/1527542/details', false); expect(visitUrl).toHaveBeenCalledWith('/1527542/details', false);
}); });
...@@ -258,11 +222,9 @@ describe('AlertManagementTable', () => { ...@@ -258,11 +222,9 @@ describe('AlertManagementTable', () => {
expect(visitUrl).not.toHaveBeenCalled(); expect(visitUrl).not.toHaveBeenCalled();
findAlerts() findAlerts().at(0).trigger('click', {
.at(0) metaKey: true,
.trigger('click', { });
metaKey: true,
});
expect(visitUrl).toHaveBeenCalledWith('/1527542/details', true); expect(visitUrl).toHaveBeenCalledWith('/1527542/details', true);
}); });
...@@ -276,24 +238,12 @@ describe('AlertManagementTable', () => { ...@@ -276,24 +238,12 @@ describe('AlertManagementTable', () => {
}); });
it('shows "None" when no link exists', () => { it('shows "None" when no link exists', () => {
expect( expect(findIssueFields().at(0).text()).toBe('None');
findIssueFields()
.at(0)
.text(),
).toBe('None');
}); });
it('renders a link when one exists', () => { it('renders a link when one exists', () => {
expect( expect(findIssueFields().at(1).text()).toBe('#1');
findIssueFields() expect(findIssueFields().at(1).attributes('href')).toBe('/gitlab-org/gitlab/-/issues/1');
.at(1)
.text(),
).toBe('#1');
expect(
findIssueFields()
.at(1)
.attributes('href'),
).toBe('/gitlab-org/gitlab/-/issues/1');
}); });
}); });
...@@ -350,11 +300,7 @@ describe('AlertManagementTable', () => { ...@@ -350,11 +300,7 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
expect( expect(findAlerts().at(0).classes()).toContain('new-alert');
findAlerts()
.at(0)
.classes(),
).toContain('new-alert');
}); });
it('should not highlight the row when alert is not new', () => { it('should not highlight the row when alert is not new', () => {
...@@ -363,11 +309,7 @@ describe('AlertManagementTable', () => { ...@@ -363,11 +309,7 @@ describe('AlertManagementTable', () => {
loading: false, loading: false,
}); });
expect( expect(findAlerts().at(0).classes()).not.toContain('new-alert');
findAlerts()
.at(0)
.classes(),
).not.toContain('new-alert');
}); });
}); });
}); });
......
...@@ -165,21 +165,9 @@ describe('Alert Details Sidebar Assignees', () => { ...@@ -165,21 +165,9 @@ describe('Alert Details Sidebar Assignees', () => {
}, },
}); });
expect( expect(findAssigned().find('img').attributes('src')).toBe('/url');
findAssigned() expect(findAssigned().find('.dropdown-menu-user-full-name').text()).toBe('root');
.find('img') expect(findAssigned().find('.dropdown-menu-user-username').text()).toBe('@root');
.attributes('src'),
).toBe('/url');
expect(
findAssigned()
.find('.dropdown-menu-user-full-name')
.text(),
).toBe('root');
expect(
findAssigned()
.find('.dropdown-menu-user-username')
.text(),
).toBe('@root');
}); });
}); });
}); });
...@@ -28,11 +28,7 @@ describe('AlertMappingBuilder', () => { ...@@ -28,11 +28,7 @@ describe('AlertMappingBuilder', () => {
}); });
const findColumnInRow = (row, column) => const findColumnInRow = (row, column) =>
wrapper wrapper.findAll('.gl-display-table-row').at(row).findAll('.gl-display-table-cell ').at(column);
.findAll('.gl-display-table-row')
.at(row)
.findAll('.gl-display-table-cell ')
.at(column);
it('renders column captions', () => { it('renders column captions', () => {
expect(findColumnInRow(0, 0).text()).toContain(i18n.columns.gitlabKeyTitle); expect(findColumnInRow(0, 0).text()).toContain(i18n.columns.gitlabKeyTitle);
......
...@@ -72,11 +72,7 @@ describe('AlertIntegrationsList', () => { ...@@ -72,11 +72,7 @@ describe('AlertIntegrationsList', () => {
it('renders an highlighted row when a current integration is selected to edit', () => { it('renders an highlighted row when a current integration is selected to edit', () => {
mountComponent({ data: { currentIntegration: { id: '1' } } }); mountComponent({ data: { currentIntegration: { id: '1' } } });
expect( expect(findTableComponentRows().at(0).classes()).toContain('gl-bg-blue-50');
findTableComponentRows()
.at(0)
.classes(),
).toContain('gl-bg-blue-50');
}); });
describe('integration status', () => { describe('integration status', () => {
......
...@@ -86,11 +86,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -86,11 +86,7 @@ describe('AlertsSettingsFormNew', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findFormFields().at(0).isVisible()).toBe(true);
findFormFields()
.at(0)
.isVisible(),
).toBe(true);
}); });
it('disables the dropdown and shows help text when multi integrations are not supported', async () => { it('disables the dropdown and shows help text when multi integrations are not supported', async () => {
...@@ -104,11 +100,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -104,11 +100,7 @@ describe('AlertsSettingsFormNew', () => {
const options = findSelect().findAll('option'); const options = findSelect().findAll('option');
await options.at(2).setSelected(); await options.at(2).setSelected();
expect( expect(findFormFields().at(0).attributes('disabled')).toBe('disabled');
findFormFields()
.at(0)
.attributes('disabled'),
).toBe('disabled');
}); });
}); });
...@@ -119,9 +111,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -119,9 +111,7 @@ describe('AlertsSettingsFormNew', () => {
const options = findSelect().findAll('option'); const options = findSelect().findAll('option');
await options.at(1).setSelected(); await options.at(1).setSelected();
await findFormFields() await findFormFields().at(0).setValue('Test integration');
.at(0)
.setValue('Test integration');
await findFormToggle().trigger('click'); await findFormToggle().trigger('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -145,12 +135,8 @@ describe('AlertsSettingsFormNew', () => { ...@@ -145,12 +135,8 @@ describe('AlertsSettingsFormNew', () => {
const options = findSelect().findAll('option'); const options = findSelect().findAll('option');
await options.at(2).setSelected(); await options.at(2).setSelected();
await findFormFields() await findFormFields().at(0).setValue('Test integration');
.at(0) await findFormFields().at(1).setValue('https://test.com');
.setValue('Test integration');
await findFormFields()
.at(1)
.setValue('https://test.com');
await findFormToggle().trigger('click'); await findFormToggle().trigger('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -179,9 +165,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -179,9 +165,7 @@ describe('AlertsSettingsFormNew', () => {
}, },
}); });
await findFormFields() await findFormFields().at(0).setValue('Test integration post');
.at(0)
.setValue('Test integration post');
await findFormToggle().trigger('click'); await findFormToggle().trigger('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -210,12 +194,8 @@ describe('AlertsSettingsFormNew', () => { ...@@ -210,12 +194,8 @@ describe('AlertsSettingsFormNew', () => {
}, },
}); });
await findFormFields() await findFormFields().at(0).setValue('Test integration');
.at(0) await findFormFields().at(1).setValue('https://test-post.com');
.setValue('Test integration');
await findFormFields()
.at(1)
.setValue('https://test-post.com');
await findFormToggle().trigger('click'); await findFormToggle().trigger('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -300,11 +280,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -300,11 +280,7 @@ describe('AlertsSettingsFormNew', () => {
resetSamplePayloadConfirmed, resetSamplePayloadConfirmed,
}); });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findTestPayloadSection().find(GlFormTextarea).attributes('disabled')).toBe(disabled);
findTestPayloadSection()
.find(GlFormTextarea)
.attributes('disabled'),
).toBe(disabled);
}); });
}); });
......
...@@ -55,10 +55,7 @@ describe('U2FAuthenticate', () => { ...@@ -55,10 +55,7 @@ describe('U2FAuthenticate', () => {
jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true); jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true);
u2fDevice = new MockU2FDevice(); u2fDevice = new MockU2FDevice();
component component.start().then(done).catch(done.fail);
.start()
.then(done)
.catch(done.fail);
}); });
it('allows authenticating via a U2F device', () => { it('allows authenticating via a U2F device', () => {
......
...@@ -15,10 +15,7 @@ describe('U2FRegister', () => { ...@@ -15,10 +15,7 @@ describe('U2FRegister', () => {
u2fDevice = new MockU2FDevice(); u2fDevice = new MockU2FDevice();
container = $('#js-register-token-2fa'); container = $('#js-register-token-2fa');
component = new U2FRegister(container, {}); component = new U2FRegister(container, {});
component component.start().then(done).catch(done.fail);
.start()
.then(done)
.catch(done.fail);
}); });
it('allows registering a U2F device', () => { it('allows registering a U2F device', () => {
......
...@@ -91,9 +91,7 @@ describe('BadgeListRow component', () => { ...@@ -91,9 +91,7 @@ describe('BadgeListRow component', () => {
beforeEach(done => { beforeEach(done => {
badge.kind = GROUP_BADGE; badge.kind = GROUP_BADGE;
Vue.nextTick() Vue.nextTick().then(done).catch(done.fail);
.then(done)
.catch(done.fail);
}); });
it('renders the badge kind', () => { it('renders the badge kind', () => {
......
...@@ -76,9 +76,7 @@ describe('BadgeList component', () => { ...@@ -76,9 +76,7 @@ describe('BadgeList component', () => {
beforeEach(done => { beforeEach(done => {
store.state.kind = GROUP_BADGE; store.state.kind = GROUP_BADGE;
Vue.nextTick() Vue.nextTick().then(done).catch(done.fail);
.then(done)
.catch(done.fail);
}); });
it('renders a message if no badges exist', done => { it('renders a message if no badges exist', done => {
......
...@@ -9,7 +9,10 @@ import { createDummyBadge, createDummyBadgeResponse } from '../dummy_badge'; ...@@ -9,7 +9,10 @@ import { createDummyBadge, createDummyBadgeResponse } from '../dummy_badge';
describe('Badges store actions', () => { describe('Badges store actions', () => {
const dummyEndpointUrl = `${TEST_HOST}/badges/endpoint`; const dummyEndpointUrl = `${TEST_HOST}/badges/endpoint`;
const dummyBadges = [{ ...createDummyBadge(), id: 5 }, { ...createDummyBadge(), id: 6 }]; const dummyBadges = [
{ ...createDummyBadge(), id: 5 },
{ ...createDummyBadge(), id: 6 },
];
let axiosMock; let axiosMock;
let badgeId; let badgeId;
......
...@@ -44,18 +44,8 @@ describe('Batch comments diff file drafts component', () => { ...@@ -44,18 +44,8 @@ describe('Batch comments diff file drafts component', () => {
expect(vm.findAll('.js-diff-notes-index').length).toEqual(2); expect(vm.findAll('.js-diff-notes-index').length).toEqual(2);
expect( expect(vm.findAll('.js-diff-notes-index').at(0).text()).toEqual('1');
vm
.findAll('.js-diff-notes-index') expect(vm.findAll('.js-diff-notes-index').at(1).text()).toEqual('2');
.at(0)
.text(),
).toEqual('1');
expect(
vm
.findAll('.js-diff-notes-index')
.at(1)
.text(),
).toEqual('2');
}); });
}); });
...@@ -32,30 +32,18 @@ describe('requiresInput', () => { ...@@ -32,30 +32,18 @@ describe('requiresInput', () => {
it('enables submit when all required fields receive input', () => { it('enables submit when all required fields receive input', () => {
$('.js-requires-input').requiresInput(); $('.js-requires-input').requiresInput();
$('#required1') $('#required1').val('input1').change();
.val('input1')
.change();
expect(submitButton).toBeDisabled(); expect(submitButton).toBeDisabled();
$('#optional1') $('#optional1').val('input1').change();
.val('input1')
.change();
expect(submitButton).toBeDisabled(); expect(submitButton).toBeDisabled();
$('#required2') $('#required2').val('input2').change();
.val('input2') $('#required3').val('input3').change();
.change(); $('#required4').val('input4').change();
$('#required3') $('#required5').val('1').change();
.val('input3')
.change();
$('#required4')
.val('input4')
.change();
$('#required5')
.val('1')
.change();
expect($('.submit')).not.toBeDisabled(); expect($('.submit')).not.toBeDisabled();
}); });
......
...@@ -32,12 +32,7 @@ describe('Blob Header Filepath', () => { ...@@ -32,12 +32,7 @@ describe('Blob Header Filepath', () => {
it('renders regular name', () => { it('renders regular name', () => {
createComponent(); createComponent();
expect( expect(wrapper.find('.js-blob-header-filepath').text().trim()).toBe(MockBlob.path);
wrapper
.find('.js-blob-header-filepath')
.text()
.trim(),
).toBe(MockBlob.path);
}); });
it('does not fail if the name is empty', () => { it('does not fail if the name is empty', () => {
...@@ -71,12 +66,7 @@ describe('Blob Header Filepath', () => { ...@@ -71,12 +66,7 @@ describe('Blob Header Filepath', () => {
); );
expect(wrapper.text()).toContain(slotContent); expect(wrapper.text()).toContain(slotContent);
expect( expect(wrapper.text().trim().substring(0, slotContent.length)).toBe(slotContent);
wrapper
.text()
.trim()
.substring(0, slotContent.length),
).toBe(slotContent);
}); });
}); });
......
...@@ -102,7 +102,7 @@ describe('BoardCardAssigneeDropdown', () => { ...@@ -102,7 +102,7 @@ describe('BoardCardAssigneeDropdown', () => {
beforeEach(() => { beforeEach(() => {
store.state.activeId = '1'; store.state.activeId = '1';
store.state.issues = { store.state.issues = {
'1': { 1: {
iid, iid,
assignees: [{ username: activeIssueName, name: activeIssueName, id: activeIssueName }], assignees: [{ username: activeIssueName, name: activeIssueName, id: activeIssueName }],
}, },
...@@ -145,12 +145,7 @@ describe('BoardCardAssigneeDropdown', () => { ...@@ -145,12 +145,7 @@ describe('BoardCardAssigneeDropdown', () => {
it('renders gl-avatar-labeled in gl-avatar-link', () => { it('renders gl-avatar-labeled in gl-avatar-link', () => {
const item = findByText('hello'); const item = findByText('hello');
expect( expect(item.find(GlAvatarLink).find(GlAvatarLabeled).exists()).toBe(true);
item
.find(GlAvatarLink)
.find(GlAvatarLabeled)
.exists(),
).toBe(true);
}); });
}); });
......
...@@ -134,9 +134,7 @@ describe('BoardCard', () => { ...@@ -134,9 +134,7 @@ describe('BoardCard', () => {
it('does not set detail issue if link is clicked', () => { it('does not set detail issue if link is clicked', () => {
mountComponent(); mountComponent();
findIssueCardInner() findIssueCardInner().find('a').trigger('mouseup');
.find('a')
.trigger('mouseup');
expect(boardsStore.detail.issue).toEqual({}); expect(boardsStore.detail.issue).toEqual({});
}); });
......
...@@ -24,12 +24,7 @@ describe('Issue Time Estimate component', () => { ...@@ -24,12 +24,7 @@ describe('Issue Time Estimate component', () => {
}); });
it('renders the correct time estimate', () => { it('renders the correct time estimate', () => {
expect( expect(wrapper.find('time').text().trim()).toEqual('2w 3d 1m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('2w 3d 1m');
}); });
it('renders expanded time estimate in tooltip', () => { it('renders expanded time estimate in tooltip', () => {
...@@ -41,12 +36,7 @@ describe('Issue Time Estimate component', () => { ...@@ -41,12 +36,7 @@ describe('Issue Time Estimate component', () => {
wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(alertSpy).not.toHaveBeenCalled(); expect(alertSpy).not.toHaveBeenCalled();
expect( expect(wrapper.find('time').text().trim()).toEqual('0m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('0m');
expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m');
done(); done();
}); });
...@@ -64,12 +54,7 @@ describe('Issue Time Estimate component', () => { ...@@ -64,12 +54,7 @@ describe('Issue Time Estimate component', () => {
}); });
it('renders the correct time estimate', () => { it('renders the correct time estimate', () => {
expect( expect(wrapper.find('time').text().trim()).toEqual('104h 1m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('104h 1m');
}); });
it('renders expanded time estimate in tooltip', () => { it('renders expanded time estimate in tooltip', () => {
......
...@@ -21,12 +21,7 @@ describe('Issue Time Estimate component', () => { ...@@ -21,12 +21,7 @@ describe('Issue Time Estimate component', () => {
}); });
it('renders the correct time estimate', () => { it('renders the correct time estimate', () => {
expect( expect(wrapper.find('time').text().trim()).toEqual('2w 3d 1m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('2w 3d 1m');
}); });
it('renders expanded time estimate in tooltip', () => { it('renders expanded time estimate in tooltip', () => {
...@@ -38,12 +33,7 @@ describe('Issue Time Estimate component', () => { ...@@ -38,12 +33,7 @@ describe('Issue Time Estimate component', () => {
wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(alertSpy).not.toHaveBeenCalled(); expect(alertSpy).not.toHaveBeenCalled();
expect( expect(wrapper.find('time').text().trim()).toEqual('0m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('0m');
expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('0m');
done(); done();
}); });
...@@ -63,12 +53,7 @@ describe('Issue Time Estimate component', () => { ...@@ -63,12 +53,7 @@ describe('Issue Time Estimate component', () => {
}); });
it('renders the correct time estimate', () => { it('renders the correct time estimate', () => {
expect( expect(wrapper.find('time').text().trim()).toEqual('104h 1m');
wrapper
.find('time')
.text()
.trim(),
).toEqual('104h 1m');
}); });
it('renders expanded time estimate in tooltip', () => { it('renders expanded time estimate in tooltip', () => {
......
...@@ -84,7 +84,10 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => { ...@@ -84,7 +84,10 @@ describe('~/boards/components/sidebar/board_sidebar_labels_select.vue', () => {
}); });
describe('when labels are updated over existing labels', () => { describe('when labels are updated over existing labels', () => {
const testLabelsPayload = [{ id: 5, set: true }, { id: 7, set: true }]; const testLabelsPayload = [
{ id: 5, set: true },
{ id: 7, set: true },
];
const expectedLabels = [{ id: 5 }, { id: 7 }]; const expectedLabels = [{ id: 5 }, { id: 7 }];
beforeEach(async () => { beforeEach(async () => {
......
...@@ -245,12 +245,7 @@ describe('Issue card component', () => { ...@@ -245,12 +245,7 @@ describe('Issue card component', () => {
}); });
it('renders more avatar counter', () => { it('renders more avatar counter', () => {
expect( expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('+2');
wrapper
.find('.board-card-assignee .avatar-counter')
.text()
.trim(),
).toEqual('+2');
}); });
it('renders two assignees', () => { it('renders two assignees', () => {
...@@ -278,12 +273,7 @@ describe('Issue card component', () => { ...@@ -278,12 +273,7 @@ describe('Issue card component', () => {
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect( expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('99+');
wrapper
.find('.board-card-assignee .avatar-counter')
.text()
.trim(),
).toEqual('99+');
done(); done();
}); });
}); });
......
...@@ -250,12 +250,7 @@ describe('Issue card component', () => { ...@@ -250,12 +250,7 @@ describe('Issue card component', () => {
}); });
it('renders more avatar counter', () => { it('renders more avatar counter', () => {
expect( expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('+2');
wrapper
.find('.board-card-assignee .avatar-counter')
.text()
.trim(),
).toEqual('+2');
}); });
it('renders two assignees', () => { it('renders two assignees', () => {
...@@ -281,12 +276,7 @@ describe('Issue card component', () => { ...@@ -281,12 +276,7 @@ describe('Issue card component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(wrapper.find('.board-card-assignee .avatar-counter').text().trim()).toEqual('99+');
wrapper
.find('.board-card-assignee .avatar-counter')
.text()
.trim(),
).toEqual('99+');
}); });
}); });
}); });
......
...@@ -39,9 +39,7 @@ describe('ProjectSelect component', () => { ...@@ -39,9 +39,7 @@ describe('ProjectSelect component', () => {
const findLabel = () => wrapper.find("[data-testid='header-label']"); const findLabel = () => wrapper.find("[data-testid='header-label']");
const findGlDropdown = () => wrapper.find(GlDropdown); const findGlDropdown = () => wrapper.find(GlDropdown);
const findGlDropdownLoadingIcon = () => const findGlDropdownLoadingIcon = () =>
findGlDropdown() findGlDropdown().find('button:first-child').find(GlLoadingIcon);
.find('button:first-child')
.find(GlLoadingIcon);
const findGlSearchBoxByType = () => wrapper.find(GlSearchBoxByType); const findGlSearchBoxByType = () => wrapper.find(GlSearchBoxByType);
const findGlDropdownItems = () => wrapper.findAll(GlDropdownItem); const findGlDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findFirstGlDropdownItem = () => findGlDropdownItems().at(0); const findFirstGlDropdownItem = () => findGlDropdownItems().at(0);
...@@ -159,9 +157,7 @@ describe('ProjectSelect component', () => { ...@@ -159,9 +157,7 @@ describe('ProjectSelect component', () => {
await createWrapper(); await createWrapper();
await findFirstGlDropdownItem() await findFirstGlDropdownItem().find('button').trigger('click');
.find('button')
.trigger('click');
}); });
it('emits setSelectedProject with correct project metadata', () => { it('emits setSelectedProject with correct project metadata', () => {
...@@ -174,11 +170,9 @@ describe('ProjectSelect component', () => { ...@@ -174,11 +170,9 @@ describe('ProjectSelect component', () => {
}); });
it('renders the name of the selected project', () => { it('renders the name of the selected project', () => {
expect( expect(findGlDropdown().find('.gl-new-dropdown-button-text').text()).toBe(
findGlDropdown() mockProjectsList1[0].name,
.find('.gl-new-dropdown-button-text') );
.text(),
).toBe(mockProjectsList1[0].name);
}); });
}); });
......
...@@ -526,8 +526,8 @@ describe('moveIssue', () => { ...@@ -526,8 +526,8 @@ describe('moveIssue', () => {
}; };
const issues = { const issues = {
'436': mockIssue, 436: mockIssue,
'437': mockIssue2, 437: mockIssue2,
}; };
const state = { const state = {
......
...@@ -39,7 +39,7 @@ describe('Boards - Getters', () => { ...@@ -39,7 +39,7 @@ describe('Boards - Getters', () => {
}); });
describe('getIssueById', () => { describe('getIssueById', () => {
const state = { issues: { '1': 'issue' } }; const state = { issues: { 1: 'issue' } };
it.each` it.each`
id | expected id | expected
...@@ -56,7 +56,7 @@ describe('Boards - Getters', () => { ...@@ -56,7 +56,7 @@ describe('Boards - Getters', () => {
${'1'} | ${'issue'} ${'1'} | ${'issue'}
${''} | ${{}} ${''} | ${{}}
`('returns $expected when $id is passed to state', ({ id, expected }) => { `('returns $expected when $id is passed to state', ({ id, expected }) => {
const state = { issues: { '1': 'issue' }, activeId: id }; const state = { issues: { 1: 'issue' }, activeId: id };
expect(getters.activeIssue(state)).toEqual(expected); expect(getters.activeIssue(state)).toEqual(expected);
}); });
......
...@@ -236,7 +236,7 @@ describe('Board Store Mutations', () => { ...@@ -236,7 +236,7 @@ describe('Board Store Mutations', () => {
'gid://gitlab/List/1': [mockIssue.id], 'gid://gitlab/List/1': [mockIssue.id],
}; };
const issues = { const issues = {
'1': mockIssue, 1: mockIssue,
}; };
state = { state = {
...@@ -345,8 +345,8 @@ describe('Board Store Mutations', () => { ...@@ -345,8 +345,8 @@ describe('Board Store Mutations', () => {
}; };
const issues = { const issues = {
'1': mockIssue, 1: mockIssue,
'2': mockIssue2, 2: mockIssue2,
}; };
state = { state = {
...@@ -374,7 +374,7 @@ describe('Board Store Mutations', () => { ...@@ -374,7 +374,7 @@ describe('Board Store Mutations', () => {
describe('MOVE_ISSUE_SUCCESS', () => { describe('MOVE_ISSUE_SUCCESS', () => {
it('updates issue in issues state', () => { it('updates issue in issues state', () => {
const issues = { const issues = {
'436': { id: rawIssue.id }, 436: { id: rawIssue.id },
}; };
state = { state = {
...@@ -386,7 +386,7 @@ describe('Board Store Mutations', () => { ...@@ -386,7 +386,7 @@ describe('Board Store Mutations', () => {
issue: rawIssue, issue: rawIssue,
}); });
expect(state.issues).toEqual({ '436': { ...mockIssue, id: 436 } }); expect(state.issues).toEqual({ 436: { ...mockIssue, id: 436 } });
}); });
}); });
...@@ -446,7 +446,7 @@ describe('Board Store Mutations', () => { ...@@ -446,7 +446,7 @@ describe('Board Store Mutations', () => {
'gid://gitlab/List/1': [mockIssue.id], 'gid://gitlab/List/1': [mockIssue.id],
}; };
const issues = { const issues = {
'1': mockIssue, 1: mockIssue,
}; };
state = { state = {
...@@ -472,8 +472,8 @@ describe('Board Store Mutations', () => { ...@@ -472,8 +472,8 @@ describe('Board Store Mutations', () => {
'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id], 'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id],
}; };
const issues = { const issues = {
'1': mockIssue, 1: mockIssue,
'2': mockIssue2, 2: mockIssue2,
}; };
state = { state = {
...@@ -496,8 +496,8 @@ describe('Board Store Mutations', () => { ...@@ -496,8 +496,8 @@ describe('Board Store Mutations', () => {
'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id], 'gid://gitlab/List/1': [mockIssue.id, mockIssue2.id],
}; };
const issues = { const issues = {
'1': mockIssue, 1: mockIssue,
'2': mockIssue2, 2: mockIssue2,
}; };
state = { state = {
......
...@@ -19,10 +19,7 @@ describe('TriggersList', () => { ...@@ -19,10 +19,7 @@ describe('TriggersList', () => {
const findHeaderAt = i => wrapper.findAll('thead th').at(i); const findHeaderAt = i => wrapper.findAll('thead th').at(i);
const findRows = () => wrapper.findAll('tbody tr'); const findRows = () => wrapper.findAll('tbody tr');
const findRowAt = i => findRows().at(i); const findRowAt = i => findRows().at(i);
const findCell = (i, col) => const findCell = (i, col) => findRowAt(i).findAll('td').at(col);
findRowAt(i)
.findAll('td')
.at(col);
const findClipboardBtn = i => findCell(i, 0).find(ClipboardButton); const findClipboardBtn = i => findCell(i, 0).find(ClipboardButton);
const findInvalidBadge = i => findCell(i, 0).find(GlBadge); const findInvalidBadge = i => findCell(i, 0).find(GlBadge);
const findEditBtn = i => findRowAt(i).find('[data-testid="edit-btn"]'); const findEditBtn = i => findRowAt(i).find('[data-testid="edit-btn"]');
...@@ -67,11 +64,7 @@ describe('TriggersList', () => { ...@@ -67,11 +64,7 @@ describe('TriggersList', () => {
it('displays a time ago label when last used', () => { it('displays a time ago label when last used', () => {
expect(findCell(0, 3).text()).toBe('Never'); expect(findCell(0, 3).text()).toBe('Never');
expect( expect(findCell(1, 3).find(TimeAgoTooltip).props('time')).toBe(triggers[1].lastUsed);
findCell(1, 3)
.find(TimeAgoTooltip)
.props('time'),
).toBe(triggers[1].lastUsed);
}); });
it('displays actions in a rows', () => { it('displays actions in a rows', () => {
......
...@@ -31,10 +31,7 @@ describe('VariableList', () => { ...@@ -31,10 +31,7 @@ describe('VariableList', () => {
it('should add another row when editing the last rows key input', () => { it('should add another row when editing the last rows key input', () => {
const $row = $wrapper.find('.js-row'); const $row = $wrapper.find('.js-row');
$row $row.find('.js-ci-variable-input-key').val('foo').trigger('input');
.find('.js-ci-variable-input-key')
.val('foo')
.trigger('input');
expect($wrapper.find('.js-row').length).toBe(2); expect($wrapper.find('.js-row').length).toBe(2);
...@@ -46,10 +43,7 @@ describe('VariableList', () => { ...@@ -46,10 +43,7 @@ describe('VariableList', () => {
it('should add another row when editing the last rows value textarea', () => { it('should add another row when editing the last rows value textarea', () => {
const $row = $wrapper.find('.js-row'); const $row = $wrapper.find('.js-row');
$row $row.find('.js-ci-variable-input-value').val('foo').trigger('input');
.find('.js-ci-variable-input-value')
.val('foo')
.trigger('input');
expect($wrapper.find('.js-row').length).toBe(2); expect($wrapper.find('.js-row').length).toBe(2);
...@@ -61,18 +55,11 @@ describe('VariableList', () => { ...@@ -61,18 +55,11 @@ describe('VariableList', () => {
it('should remove empty row after blurring', () => { it('should remove empty row after blurring', () => {
const $row = $wrapper.find('.js-row'); const $row = $wrapper.find('.js-row');
$row $row.find('.js-ci-variable-input-key').val('foo').trigger('input');
.find('.js-ci-variable-input-key')
.val('foo')
.trigger('input');
expect($wrapper.find('.js-row').length).toBe(2); expect($wrapper.find('.js-row').length).toBe(2);
$row $row.find('.js-ci-variable-input-key').val('').trigger('input').trigger('blur');
.find('.js-ci-variable-input-key')
.val('')
.trigger('input')
.trigger('blur');
expect($wrapper.find('.js-row').length).toBe(1); expect($wrapper.find('.js-row').length).toBe(1);
}); });
......
...@@ -44,10 +44,7 @@ describe('ClusterFormDropdown', () => { ...@@ -44,10 +44,7 @@ describe('ClusterFormDropdown', () => {
wrapper.setProps({ items }); wrapper.setProps({ items });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
wrapper wrapper.findAll('.js-dropdown-item').at(1).trigger('click');
.findAll('.js-dropdown-item')
.at(1)
.trigger('click');
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}); });
}); });
...@@ -65,17 +62,11 @@ describe('ClusterFormDropdown', () => { ...@@ -65,17 +62,11 @@ describe('ClusterFormDropdown', () => {
return wrapper.vm return wrapper.vm
.$nextTick() .$nextTick()
.then(() => { .then(() => {
wrapper wrapper.findAll('.js-dropdown-item').at(0).trigger('click');
.findAll('.js-dropdown-item')
.at(0)
.trigger('click');
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}) })
.then(() => { .then(() => {
wrapper wrapper.findAll('.js-dropdown-item').at(1).trigger('click');
.findAll('.js-dropdown-item')
.at(1)
.trigger('click');
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}); });
}); });
...@@ -102,10 +93,7 @@ describe('ClusterFormDropdown', () => { ...@@ -102,10 +93,7 @@ describe('ClusterFormDropdown', () => {
wrapper.setProps({ items, multiple: true, value: null }); wrapper.setProps({ items, multiple: true, value: null });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
wrapper wrapper.findAll('.js-dropdown-item').at(0).trigger('click');
.findAll('.js-dropdown-item')
.at(0)
.trigger('click');
expect(wrapper.emitted('input')[0]).toEqual([[firstItem.value]]); expect(wrapper.emitted('input')[0]).toEqual([[firstItem.value]]);
}); });
......
...@@ -101,7 +101,10 @@ describe('awsServicesFacade', () => { ...@@ -101,7 +101,10 @@ describe('awsServicesFacade', () => {
let vpcsOutput; let vpcsOutput;
beforeEach(() => { beforeEach(() => {
vpcs = [{ VpcId: 'vpc-1', Tags: [] }, { VpcId: 'vpc-2', Tags: [] }]; vpcs = [
{ VpcId: 'vpc-1', Tags: [] },
{ VpcId: 'vpc-2', Tags: [] },
];
vpcsOutput = vpcs.map(({ VpcId: vpcId }) => ({ name: vpcId, value: vpcId })); vpcsOutput = vpcs.map(({ VpcId: vpcId }) => ({ name: vpcId, value: vpcId }));
mockDescribeVpcsPromise.mockResolvedValueOnce({ Vpcs: vpcs }); mockDescribeVpcsPromise.mockResolvedValueOnce({ Vpcs: vpcs });
......
...@@ -29,10 +29,7 @@ describe('Deploy freeze modal', () => { ...@@ -29,10 +29,7 @@ describe('Deploy freeze modal', () => {
}); });
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.find(GlModal);
const addDeployFreezeButton = () => const addDeployFreezeButton = () => findModal().findAll(GlButton).at(1);
findModal()
.findAll(GlButton)
.at(1);
const setInput = (freezeStartCron, freezeEndCron, selectedTimezone) => { const setInput = (freezeStartCron, freezeEndCron, selectedTimezone) => {
store.state.freezeStartCron = freezeStartCron; store.state.freezeStartCron = freezeStartCron;
......
...@@ -64,12 +64,7 @@ describe('Deploy keys app component', () => { ...@@ -64,12 +64,7 @@ describe('Deploy keys app component', () => {
expect(element.exists()).toBe(true); expect(element.exists()).toBe(true);
expect(element.text().trim()).toContain(label); expect(element.text().trim()).toContain(label);
expect( expect(element.find('.badge').text().trim()).toBe(count.toString());
element
.find('.badge')
.text()
.trim(),
).toBe(count.toString());
}); });
}); });
......
...@@ -9,11 +9,7 @@ describe('Deploy keys key', () => { ...@@ -9,11 +9,7 @@ describe('Deploy keys key', () => {
const data = getJSONFixture('deploy_keys/keys.json'); const data = getJSONFixture('deploy_keys/keys.json');
const findTextAndTrim = selector => const findTextAndTrim = selector => wrapper.find(selector).text().trim();
wrapper
.find(selector)
.text()
.trim();
const createComponent = propsData => { const createComponent = propsData => {
wrapper = mount(key, { wrapper = mount(key, {
...@@ -103,10 +99,7 @@ describe('Deploy keys key', () => { ...@@ -103,10 +99,7 @@ describe('Deploy keys key', () => {
it('expands all project labels after click', () => { it('expands all project labels after click', () => {
createComponent({ deployKey }); createComponent({ deployKey });
const { length } = deployKey.deploy_keys_projects; const { length } = deployKey.deploy_keys_projects;
wrapper wrapper.findAll('.deploy-project-label').at(1).trigger('click');
.findAll('.deploy-project-label')
.at(1)
.trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
const labels = wrapper.findAll('.deploy-project-label'); const labels = wrapper.findAll('.deploy-project-label');
......
...@@ -48,12 +48,9 @@ describe('Deploy keys panel', () => { ...@@ -48,12 +48,9 @@ describe('Deploy keys panel', () => {
expect(wrapper.find('.settings-message').exists()).toBe(true); expect(wrapper.find('.settings-message').exists()).toBe(true);
expect( expect(wrapper.find('.settings-message').text().trim()).toBe(
wrapper 'No deploy keys found. Create one with the form above.',
.find('.settings-message') );
.text()
.trim(),
).toBe('No deploy keys found. Create one with the form above.');
}); });
it('renders no table header if keys are empty', () => { it('renders no table header if keys are empty', () => {
......
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