Commit f2d28d7a authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 68 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 94cfbb0c
...@@ -435,7 +435,7 @@ describe('Release detail actions', () => { ...@@ -435,7 +435,7 @@ describe('Release detail actions', () => {
expect(api.deleteReleaseLink).toHaveBeenCalledTimes( expect(api.deleteReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToDelete.length, getters.releaseLinksToDelete.length,
); );
getters.releaseLinksToDelete.forEach(link => { getters.releaseLinksToDelete.forEach((link) => {
expect(api.deleteReleaseLink).toHaveBeenCalledWith( expect(api.deleteReleaseLink).toHaveBeenCalledWith(
state.projectId, state.projectId,
state.tagName, state.tagName,
...@@ -446,7 +446,7 @@ describe('Release detail actions', () => { ...@@ -446,7 +446,7 @@ describe('Release detail actions', () => {
expect(api.createReleaseLink).toHaveBeenCalledTimes( expect(api.createReleaseLink).toHaveBeenCalledTimes(
getters.releaseLinksToCreate.length, getters.releaseLinksToCreate.length,
); );
getters.releaseLinksToCreate.forEach(link => { getters.releaseLinksToCreate.forEach((link) => {
expect(api.createReleaseLink).toHaveBeenCalledWith( expect(api.createReleaseLink).toHaveBeenCalledWith(
state.projectId, state.projectId,
state.tagName, state.tagName,
......
import state from '~/releases/stores/modules/list/state'; import state from '~/releases/stores/modules/list/state';
export const resetStore = store => { export const resetStore = (store) => {
store.replaceState(state()); store.replaceState(state());
}; };
...@@ -17,7 +17,7 @@ describe('Accessibility Reports actions', () => { ...@@ -17,7 +17,7 @@ describe('Accessibility Reports actions', () => {
}); });
describe('setEndpoints', () => { describe('setEndpoints', () => {
it('should commit SET_ENDPOINTS mutation', done => { it('should commit SET_ENDPOINTS mutation', (done) => {
const endpoint = 'endpoint.json'; const endpoint = 'endpoint.json';
testAction( testAction(
...@@ -46,7 +46,7 @@ describe('Accessibility Reports actions', () => { ...@@ -46,7 +46,7 @@ describe('Accessibility Reports actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('should commit REQUEST_REPORT mutation and dispatch receiveReportSuccess', done => { it('should commit REQUEST_REPORT mutation and dispatch receiveReportSuccess', (done) => {
const data = { report: { summary: {} } }; const data = { report: { summary: {} } };
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(200, data); mock.onGet(`${TEST_HOST}/endpoint.json`).reply(200, data);
...@@ -67,7 +67,7 @@ describe('Accessibility Reports actions', () => { ...@@ -67,7 +67,7 @@ describe('Accessibility Reports actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('should commit REQUEST_REPORT and RECEIVE_REPORT_ERROR mutations', done => { it('should commit REQUEST_REPORT and RECEIVE_REPORT_ERROR mutations', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
testAction( testAction(
...@@ -83,7 +83,7 @@ describe('Accessibility Reports actions', () => { ...@@ -83,7 +83,7 @@ describe('Accessibility Reports actions', () => {
}); });
describe('receiveReportSuccess', () => { describe('receiveReportSuccess', () => {
it('should commit RECEIVE_REPORT_SUCCESS mutation with 200', done => { it('should commit RECEIVE_REPORT_SUCCESS mutation with 200', (done) => {
testAction( testAction(
actions.receiveReportSuccess, actions.receiveReportSuccess,
{ status: 200, data: mockReport }, { status: 200, data: mockReport },
...@@ -94,7 +94,7 @@ describe('Accessibility Reports actions', () => { ...@@ -94,7 +94,7 @@ describe('Accessibility Reports actions', () => {
); );
}); });
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => { it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', (done) => {
testAction( testAction(
actions.receiveReportSuccess, actions.receiveReportSuccess,
{ status: 204, data: mockReport }, { status: 204, data: mockReport },
...@@ -107,7 +107,7 @@ describe('Accessibility Reports actions', () => { ...@@ -107,7 +107,7 @@ describe('Accessibility Reports actions', () => {
}); });
describe('receiveReportError', () => { describe('receiveReportError', () => {
it('should commit RECEIVE_REPORT_ERROR mutation', done => { it('should commit RECEIVE_REPORT_ERROR mutation', (done) => {
testAction( testAction(
actions.receiveReportError, actions.receiveReportError,
null, null,
......
...@@ -33,7 +33,7 @@ describe('Codequality Reports actions', () => { ...@@ -33,7 +33,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('setPaths', () => { describe('setPaths', () => {
it('should commit SET_PATHS mutation', done => { it('should commit SET_PATHS mutation', (done) => {
const paths = { const paths = {
basePath: 'basePath', basePath: 'basePath',
headPath: 'headPath', headPath: 'headPath',
...@@ -67,7 +67,7 @@ describe('Codequality Reports actions', () => { ...@@ -67,7 +67,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('on success', () => { describe('on success', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', done => { it('commits REQUEST_REPORTS and dispatches receiveReportsSuccess', (done) => {
mock.onGet(`${TEST_HOST}/head.json`).reply(200, headIssues); mock.onGet(`${TEST_HOST}/head.json`).reply(200, headIssues);
mock.onGet(`${TEST_HOST}/base.json`).reply(200, baseIssues); mock.onGet(`${TEST_HOST}/base.json`).reply(200, baseIssues);
...@@ -91,7 +91,7 @@ describe('Codequality Reports actions', () => { ...@@ -91,7 +91,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('on error', () => { describe('on error', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', done => { it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => {
mock.onGet(`${TEST_HOST}/head.json`).reply(500); mock.onGet(`${TEST_HOST}/head.json`).reply(500);
testAction( testAction(
...@@ -106,7 +106,7 @@ describe('Codequality Reports actions', () => { ...@@ -106,7 +106,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('with no base path', () => { describe('with no base path', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', done => { it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => {
localState.basePath = null; localState.basePath = null;
testAction( testAction(
...@@ -122,7 +122,7 @@ describe('Codequality Reports actions', () => { ...@@ -122,7 +122,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('receiveReportsSuccess', () => { describe('receiveReportsSuccess', () => {
it('commits RECEIVE_REPORTS_SUCCESS', done => { it('commits RECEIVE_REPORTS_SUCCESS', (done) => {
const data = { issues: [] }; const data = { issues: [] };
testAction( testAction(
...@@ -137,7 +137,7 @@ describe('Codequality Reports actions', () => { ...@@ -137,7 +137,7 @@ describe('Codequality Reports actions', () => {
}); });
describe('receiveReportsError', () => { describe('receiveReportsError', () => {
it('commits RECEIVE_REPORTS_ERROR', done => { it('commits RECEIVE_REPORTS_ERROR', (done) => {
testAction( testAction(
actions.receiveReportsError, actions.receiveReportsError,
null, null,
......
...@@ -11,17 +11,17 @@ jest.mock('~/reports/codequality_report/workers/codequality_comparison_worker', ...@@ -11,17 +11,17 @@ jest.mock('~/reports/codequality_report/workers/codequality_comparison_worker',
addEventListener: (_, callback) => { addEventListener: (_, callback) => {
mockPostMessageCallback = callback; mockPostMessageCallback = callback;
}, },
postMessage: data => { postMessage: (data) => {
if (!data.headIssues) return mockPostMessageCallback({ data: {} }); if (!data.headIssues) return mockPostMessageCallback({ data: {} });
if (!data.baseIssues) throw new Error(); if (!data.baseIssues) throw new Error();
const key = 'fingerprint'; const key = 'fingerprint';
return mockPostMessageCallback({ return mockPostMessageCallback({
data: { data: {
newIssues: data.headIssues.filter( newIssues: data.headIssues.filter(
item => !data.baseIssues.find(el => el[key] === item[key]), (item) => !data.baseIssues.find((el) => el[key] === item[key]),
), ),
resolvedIssues: data.baseIssues.filter( resolvedIssues: data.baseIssues.filter(
item => !data.headIssues.find(el => el[key] === item[key]), (item) => !data.headIssues.find((el) => el[key] === item[key]),
), ),
}, },
}); });
......
...@@ -13,7 +13,7 @@ describe('Grouped Issues List', () => { ...@@ -13,7 +13,7 @@ describe('Grouped Issues List', () => {
}); });
}; };
const findHeading = groupName => wrapper.find(`[data-testid="${groupName}Heading"`); const findHeading = (groupName) => wrapper.find(`[data-testid="${groupName}Heading"`);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -37,7 +37,7 @@ describe('Grouped Issues List', () => { ...@@ -37,7 +37,7 @@ describe('Grouped Issues List', () => {
describe('without data', () => { describe('without data', () => {
beforeEach(createComponent); beforeEach(createComponent);
it.each(['unresolved', 'resolved'])('does not a render a header for %s issues', issueName => { it.each(['unresolved', 'resolved'])('does not a render a header for %s issues', (issueName) => {
expect(findHeading(issueName).exists()).toBe(false); expect(findHeading(issueName).exists()).toBe(false);
}); });
...@@ -59,7 +59,7 @@ describe('Grouped Issues List', () => { ...@@ -59,7 +59,7 @@ describe('Grouped Issues List', () => {
expect(findHeading(groupName).text()).toBe(givenHeading); expect(findHeading(groupName).text()).toBe(givenHeading);
}); });
it.each(['resolved', 'unresolved'])('renders all %s issues', issueName => { it.each(['resolved', 'unresolved'])('renders all %s issues', (issueName) => {
const issues = [{ name: 'foo' }, { name: 'bar' }]; const issues = [{ name: 'foo' }, { name: 'bar' }];
createComponent({ createComponent({
......
...@@ -39,7 +39,7 @@ describe('Grouped test reports app', () => { ...@@ -39,7 +39,7 @@ describe('Grouped test reports app', () => {
}); });
}; };
const setReports = reports => { const setReports = (reports) => {
mockStore.state.status = reports.status; mockStore.state.status = reports.status;
mockStore.state.summary = reports.summary; mockStore.state.summary = reports.summary;
mockStore.state.reports = reports.suites; mockStore.state.reports = reports.suites;
......
...@@ -20,7 +20,7 @@ describe('IssueStatusIcon', () => { ...@@ -20,7 +20,7 @@ describe('IssueStatusIcon', () => {
it.each([STATUS_SUCCESS, STATUS_NEUTRAL, STATUS_FAILED])( it.each([STATUS_SUCCESS, STATUS_NEUTRAL, STATUS_FAILED])(
'renders "%s" state correctly', 'renders "%s" state correctly',
status => { (status) => {
createComponent({ status }); createComponent({ status });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
......
...@@ -29,7 +29,7 @@ describe('Report section', () => { ...@@ -29,7 +29,7 @@ describe('Report section', () => {
alwaysOpen: false, alwaysOpen: false,
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(reportSection, { wrapper = shallowMount(reportSection, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
...@@ -67,7 +67,7 @@ describe('Report section', () => { ...@@ -67,7 +67,7 @@ describe('Report section', () => {
const issues = hasIssues ? 'has issues' : 'has no issues'; const issues = hasIssues ? 'has issues' : 'has no issues';
const open = alwaysOpen ? 'is always open' : 'is not always open'; const open = alwaysOpen ? 'is always open' : 'is not always open';
it(`is ${isCollapsible}, if the report ${issues} and ${open}`, done => { it(`is ${isCollapsible}, if the report ${issues} and ${open}`, (done) => {
vm.hasIssues = hasIssues; vm.hasIssues = hasIssues;
vm.alwaysOpen = alwaysOpen; vm.alwaysOpen = alwaysOpen;
...@@ -93,7 +93,7 @@ describe('Report section', () => { ...@@ -93,7 +93,7 @@ describe('Report section', () => {
const issues = isCollapsed ? 'is collapsed' : 'is not collapsed'; const issues = isCollapsed ? 'is collapsed' : 'is not collapsed';
const open = alwaysOpen ? 'is always open' : 'is not always open'; const open = alwaysOpen ? 'is always open' : 'is not always open';
it(`is ${isExpanded}, if the report ${issues} and ${open}`, done => { it(`is ${isExpanded}, if the report ${issues} and ${open}`, (done) => {
vm.isCollapsed = isCollapsed; vm.isCollapsed = isCollapsed;
vm.alwaysOpen = alwaysOpen; vm.alwaysOpen = alwaysOpen;
...@@ -144,7 +144,7 @@ describe('Report section', () => { ...@@ -144,7 +144,7 @@ describe('Report section', () => {
describe('toggleCollapsed', () => { describe('toggleCollapsed', () => {
const hiddenCss = { display: 'none' }; const hiddenCss = { display: 'none' };
it('toggles issues', done => { it('toggles issues', (done) => {
vm.$el.querySelector('button').click(); vm.$el.querySelector('button').click();
Vue.nextTick() Vue.nextTick()
...@@ -163,7 +163,7 @@ describe('Report section', () => { ...@@ -163,7 +163,7 @@ describe('Report section', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('is always expanded, if always-open is set to true', done => { it('is always expanded, if always-open is set to true', (done) => {
vm.alwaysOpen = true; vm.alwaysOpen = true;
Vue.nextTick() Vue.nextTick()
.then(() => { .then(() => {
...@@ -177,7 +177,7 @@ describe('Report section', () => { ...@@ -177,7 +177,7 @@ describe('Report section', () => {
}); });
describe('snowplow events', () => { describe('snowplow events', () => {
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', done => { it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', (done) => {
createComponent({ hasIssues: true, shouldEmitToggleEvent: true }); createComponent({ hasIssues: true, shouldEmitToggleEvent: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined(); expect(wrapper.emitted().toggleEvent).toBeUndefined();
...@@ -192,7 +192,7 @@ describe('Report section', () => { ...@@ -192,7 +192,7 @@ describe('Report section', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => { it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', (done) => {
createComponent({ hasIssues: true }); createComponent({ hasIssues: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined(); expect(wrapper.emitted().toggleEvent).toBeUndefined();
...@@ -207,7 +207,7 @@ describe('Report section', () => { ...@@ -207,7 +207,7 @@ describe('Report section', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not emit an event if always-open is set to true', done => { it('does not emit an event if always-open is set to true', (done) => {
createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true }); createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true });
wrapper.vm wrapper.vm
...@@ -259,7 +259,7 @@ describe('Report section', () => { ...@@ -259,7 +259,7 @@ describe('Report section', () => {
}); });
describe('Success and Error slots', () => { describe('Success and Error slots', () => {
const createComponentWithSlots = status => { const createComponentWithSlots = (status) => {
vm = mountComponentWithSlots(ReportSection, { vm = mountComponentWithSlots(ReportSection, {
props: { props: {
status, status,
......
...@@ -24,7 +24,7 @@ describe('Reports Store Actions', () => { ...@@ -24,7 +24,7 @@ describe('Reports Store Actions', () => {
}); });
describe('setEndpoint', () => { describe('setEndpoint', () => {
it('should commit SET_ENDPOINT mutation', done => { it('should commit SET_ENDPOINT mutation', (done) => {
testAction( testAction(
setEndpoint, setEndpoint,
'endpoint.json', 'endpoint.json',
...@@ -37,7 +37,7 @@ describe('Reports Store Actions', () => { ...@@ -37,7 +37,7 @@ describe('Reports Store Actions', () => {
}); });
describe('requestReports', () => { describe('requestReports', () => {
it('should commit REQUEST_REPORTS mutation', done => { it('should commit REQUEST_REPORTS mutation', (done) => {
testAction(requestReports, null, mockedState, [{ type: types.REQUEST_REPORTS }], [], done); testAction(requestReports, null, mockedState, [{ type: types.REQUEST_REPORTS }], [], done);
}); });
}); });
...@@ -57,7 +57,7 @@ describe('Reports Store Actions', () => { ...@@ -57,7 +57,7 @@ describe('Reports Store Actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestReports and receiveReportsSuccess ', done => { it('dispatches requestReports and receiveReportsSuccess ', (done) => {
mock mock
.onGet(`${TEST_HOST}/endpoint.json`) .onGet(`${TEST_HOST}/endpoint.json`)
.replyOnce(200, { summary: {}, suites: [{ name: 'rspec' }] }); .replyOnce(200, { summary: {}, suites: [{ name: 'rspec' }] });
...@@ -86,7 +86,7 @@ describe('Reports Store Actions', () => { ...@@ -86,7 +86,7 @@ describe('Reports Store Actions', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500); mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
}); });
it('dispatches requestReports and receiveReportsError ', done => { it('dispatches requestReports and receiveReportsError ', (done) => {
testAction( testAction(
fetchReports, fetchReports,
null, null,
...@@ -107,7 +107,7 @@ describe('Reports Store Actions', () => { ...@@ -107,7 +107,7 @@ describe('Reports Store Actions', () => {
}); });
describe('receiveReportsSuccess', () => { describe('receiveReportsSuccess', () => {
it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', done => { it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', (done) => {
testAction( testAction(
receiveReportsSuccess, receiveReportsSuccess,
{ data: { summary: {} }, status: 200 }, { data: { summary: {} }, status: 200 },
...@@ -118,7 +118,7 @@ describe('Reports Store Actions', () => { ...@@ -118,7 +118,7 @@ describe('Reports Store Actions', () => {
); );
}); });
it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => { it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', (done) => {
testAction( testAction(
receiveReportsSuccess, receiveReportsSuccess,
{ data: { summary: {} }, status: 204 }, { data: { summary: {} }, status: 204 },
...@@ -131,7 +131,7 @@ describe('Reports Store Actions', () => { ...@@ -131,7 +131,7 @@ describe('Reports Store Actions', () => {
}); });
describe('receiveReportsError', () => { describe('receiveReportsError', () => {
it('should commit RECEIVE_REPORTS_ERROR mutation', done => { it('should commit RECEIVE_REPORTS_ERROR mutation', (done) => {
testAction( testAction(
receiveReportsError, receiveReportsError,
null, null,
...@@ -144,7 +144,7 @@ describe('Reports Store Actions', () => { ...@@ -144,7 +144,7 @@ describe('Reports Store Actions', () => {
}); });
describe('openModal', () => { describe('openModal', () => {
it('should dispatch setModalData', done => { it('should dispatch setModalData', (done) => {
testAction( testAction(
openModal, openModal,
{ name: 'foo' }, { name: 'foo' },
...@@ -157,7 +157,7 @@ describe('Reports Store Actions', () => { ...@@ -157,7 +157,7 @@ describe('Reports Store Actions', () => {
}); });
describe('setModalData', () => { describe('setModalData', () => {
it('should commit SET_ISSUE_MODAL_DATA', done => { it('should commit SET_ISSUE_MODAL_DATA', (done) => {
testAction( testAction(
setModalData, setModalData,
{ name: 'foo' }, { name: 'foo' },
......
...@@ -12,7 +12,7 @@ let $collapseIcon = null; ...@@ -12,7 +12,7 @@ let $collapseIcon = null;
let $page = null; let $page = null;
let $labelsIcon = null; let $labelsIcon = null;
const assertSidebarState = state => { const assertSidebarState = (state) => {
const shouldBeExpanded = state === 'expanded'; const shouldBeExpanded = state === 'expanded';
const shouldBeCollapsed = state === 'collapsed'; const shouldBeCollapsed = state === 'collapsed';
expect($aside.hasClass('right-sidebar-expanded')).toBe(shouldBeExpanded); expect($aside.hasClass('right-sidebar-expanded')).toBe(shouldBeExpanded);
...@@ -67,7 +67,7 @@ describe('RightSidebar', () => { ...@@ -67,7 +67,7 @@ describe('RightSidebar', () => {
assertSidebarState('collapsed'); assertSidebarState('collapsed');
}); });
it('should broadcast todo:toggle event when add todo clicked', done => { it('should broadcast todo:toggle event when add todo clicked', (done) => {
const todos = getJSONFixture('todos/todos.json'); const todos = getJSONFixture('todos/todos.json');
mock.onPost(/(.*)\/todos$/).reply(200, todos); mock.onPost(/(.*)\/todos$/).reply(200, todos);
...@@ -84,7 +84,7 @@ describe('RightSidebar', () => { ...@@ -84,7 +84,7 @@ describe('RightSidebar', () => {
}); });
it('should not hide collapsed icons', () => { it('should not hide collapsed icons', () => {
[].forEach.call(document.querySelectorAll('.sidebar-collapsed-icon'), el => { [].forEach.call(document.querySelectorAll('.sidebar-collapsed-icon'), (el) => {
expect(el.querySelector('.fa, svg').classList.contains('hidden')).toBeFalsy(); expect(el.querySelector('.fa, svg').classList.contains('hidden')).toBeFalsy();
}); });
}); });
......
...@@ -8,7 +8,7 @@ jest.mock('~/search/sidebar'); ...@@ -8,7 +8,7 @@ jest.mock('~/search/sidebar');
describe('initSearchApp', () => { describe('initSearchApp', () => {
let defaultLocation; let defaultLocation;
const setUrl = query => { const setUrl = (query) => {
window.location.href = `https://localhost:3000/search${query}`; window.location.href = `https://localhost:3000/search${query}`;
window.location.search = query; window.location.search = query;
}; };
......
...@@ -17,7 +17,7 @@ describe('GlobalSearchSidebar', () => { ...@@ -17,7 +17,7 @@ describe('GlobalSearchSidebar', () => {
resetQuery: jest.fn(), resetQuery: jest.fn(),
}; };
const createComponent = initialState => { const createComponent = (initialState) => {
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
query: MOCK_QUERY, query: MOCK_QUERY,
......
...@@ -15,7 +15,7 @@ describe('ConfidentialityFilter', () => { ...@@ -15,7 +15,7 @@ describe('ConfidentialityFilter', () => {
resetQuery: jest.fn(), resetQuery: jest.fn(),
}; };
const createComponent = initialState => { const createComponent = (initialState) => {
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
query: MOCK_QUERY, query: MOCK_QUERY,
......
...@@ -46,7 +46,7 @@ describe('RadioFilter', () => { ...@@ -46,7 +46,7 @@ describe('RadioFilter', () => {
const findGlRadioButtonGroup = () => wrapper.find(GlFormRadioGroup); const findGlRadioButtonGroup = () => wrapper.find(GlFormRadioGroup);
const findGlRadioButtons = () => findGlRadioButtonGroup().findAll(GlFormRadio); const findGlRadioButtons = () => findGlRadioButtonGroup().findAll(GlFormRadio);
const findGlRadioButtonsText = () => findGlRadioButtons().wrappers.map(w => w.text()); const findGlRadioButtonsText = () => findGlRadioButtons().wrappers.map((w) => w.text());
describe('template', () => { describe('template', () => {
beforeEach(() => { beforeEach(() => {
...@@ -61,7 +61,7 @@ describe('RadioFilter', () => { ...@@ -61,7 +61,7 @@ describe('RadioFilter', () => {
describe('Status Filter', () => { describe('Status Filter', () => {
it('renders a radio button for each filterOption', () => { it('renders a radio button for each filterOption', () => {
expect(findGlRadioButtonsText()).toStrictEqual( expect(findGlRadioButtonsText()).toStrictEqual(
stateFilterData.filterByScope[stateFilterData.scopes.ISSUES].map(f => { stateFilterData.filterByScope[stateFilterData.scopes.ISSUES].map((f) => {
return f.value === stateFilterData.filters.ANY.value return f.value === stateFilterData.filters.ANY.value
? `Any ${stateFilterData.header.toLowerCase()}` ? `Any ${stateFilterData.header.toLowerCase()}`
: f.label; : f.label;
...@@ -87,7 +87,7 @@ describe('RadioFilter', () => { ...@@ -87,7 +87,7 @@ describe('RadioFilter', () => {
it('renders a radio button for each filterOption', () => { it('renders a radio button for each filterOption', () => {
expect(findGlRadioButtonsText()).toStrictEqual( expect(findGlRadioButtonsText()).toStrictEqual(
confidentialFilterData.filterByScope[confidentialFilterData.scopes.ISSUES].map(f => { confidentialFilterData.filterByScope[confidentialFilterData.scopes.ISSUES].map((f) => {
return f.value === confidentialFilterData.filters.ANY.value return f.value === confidentialFilterData.filters.ANY.value
? `Any ${confidentialFilterData.header.toLowerCase()}` ? `Any ${confidentialFilterData.header.toLowerCase()}`
: f.label; : f.label;
......
...@@ -15,7 +15,7 @@ describe('StatusFilter', () => { ...@@ -15,7 +15,7 @@ describe('StatusFilter', () => {
resetQuery: jest.fn(), resetQuery: jest.fn(),
}; };
const createComponent = initialState => { const createComponent = (initialState) => {
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
query: MOCK_QUERY, query: MOCK_QUERY,
......
...@@ -47,7 +47,7 @@ describe('Global Search Searchable Dropdown', () => { ...@@ -47,7 +47,7 @@ describe('Global Search Searchable Dropdown', () => {
const findGlDropdownSearch = () => findGlDropdown().find(GlSearchBoxByType); const findGlDropdownSearch = () => findGlDropdown().find(GlSearchBoxByType);
const findDropdownText = () => findGlDropdown().find('.dropdown-toggle-text'); const findDropdownText = () => findGlDropdown().find('.dropdown-toggle-text');
const findDropdownItems = () => findGlDropdown().findAll(GlDropdownItem); const findDropdownItems = () => findGlDropdown().findAll(GlDropdownItem);
const findDropdownItemsText = () => findDropdownItems().wrappers.map(w => w.text()); const findDropdownItemsText = () => findDropdownItems().wrappers.map((w) => w.text());
const findAnyDropdownItem = () => findDropdownItems().at(0); const findAnyDropdownItem = () => findDropdownItems().at(0);
const findFirstGroupDropdownItem = () => findDropdownItems().at(1); const findFirstGroupDropdownItem = () => findDropdownItems().at(1);
const findLoader = () => wrapper.find(GlSkeletonLoader); const findLoader = () => wrapper.find(GlSkeletonLoader);
...@@ -94,7 +94,7 @@ describe('Global Search Searchable Dropdown', () => { ...@@ -94,7 +94,7 @@ describe('Global Search Searchable Dropdown', () => {
}); });
it('renders an instance for each namespace', () => { it('renders an instance for each namespace', () => {
const resultsIncludeAny = ['Any'].concat(MOCK_GROUPS.map(n => n.full_name)); const resultsIncludeAny = ['Any'].concat(MOCK_GROUPS.map((n) => n.full_name));
expect(findDropdownItemsText()).toStrictEqual(resultsIncludeAny); expect(findDropdownItemsText()).toStrictEqual(resultsIncludeAny);
}); });
}); });
......
...@@ -32,7 +32,7 @@ describe('Search autocomplete dropdown', () => { ...@@ -32,7 +32,7 @@ describe('Search autocomplete dropdown', () => {
// Add required attributes to body before starting the test. // Add required attributes to body before starting the test.
// section would be dashboard|group|project // section would be dashboard|group|project
const addBodyAttributes = section => { const addBodyAttributes = (section) => {
if (section == null) { if (section == null) {
section = 'dashboard'; section = 'dashboard';
} }
...@@ -213,10 +213,10 @@ describe('Search autocomplete dropdown', () => { ...@@ -213,10 +213,10 @@ describe('Search autocomplete dropdown', () => {
}); });
function triggerAutocomplete() { function triggerAutocomplete() {
return new Promise(resolve => { return new Promise((resolve) => {
const dropdown = widget.searchInput.data('deprecatedJQueryDropdown'); const dropdown = widget.searchInput.data('deprecatedJQueryDropdown');
const filterCallback = dropdown.filter.options.callback; const filterCallback = dropdown.filter.options.callback;
dropdown.filter.options.callback = jest.fn(data => { dropdown.filter.options.callback = jest.fn((data) => {
filterCallback(data); filterCallback(data);
resolve(); resolve();
...@@ -227,7 +227,7 @@ describe('Search autocomplete dropdown', () => { ...@@ -227,7 +227,7 @@ describe('Search autocomplete dropdown', () => {
}); });
} }
it('suggest Projects', done => { it('suggest Projects', (done) => {
// eslint-disable-next-line promise/catch-or-return // eslint-disable-next-line promise/catch-or-return
triggerAutocomplete().finally(() => { triggerAutocomplete().finally(() => {
const list = widget.wrap.find('.dropdown-menu').find('ul'); const list = widget.wrap.find('.dropdown-menu').find('ul');
...@@ -242,7 +242,7 @@ describe('Search autocomplete dropdown', () => { ...@@ -242,7 +242,7 @@ describe('Search autocomplete dropdown', () => {
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
}); });
it('suggest Groups', done => { it('suggest Groups', (done) => {
// eslint-disable-next-line promise/catch-or-return // eslint-disable-next-line promise/catch-or-return
triggerAutocomplete().finally(() => { triggerAutocomplete().finally(() => {
const list = widget.wrap.find('.dropdown-menu').find('ul'); const list = widget.wrap.find('.dropdown-menu').find('ul');
......
...@@ -16,7 +16,7 @@ describe('self monitor actions', () => { ...@@ -16,7 +16,7 @@ describe('self monitor actions', () => {
}); });
describe('setSelfMonitor', () => { describe('setSelfMonitor', () => {
it('commits the SET_ENABLED mutation', done => { it('commits the SET_ENABLED mutation', (done) => {
testAction( testAction(
actions.setSelfMonitor, actions.setSelfMonitor,
null, null,
...@@ -29,7 +29,7 @@ describe('self monitor actions', () => { ...@@ -29,7 +29,7 @@ describe('self monitor actions', () => {
}); });
describe('resetAlert', () => { describe('resetAlert', () => {
it('commits the SET_ENABLED mutation', done => { it('commits the SET_ENABLED mutation', (done) => {
testAction( testAction(
actions.resetAlert, actions.resetAlert,
null, null,
...@@ -54,7 +54,7 @@ describe('self monitor actions', () => { ...@@ -54,7 +54,7 @@ describe('self monitor actions', () => {
}); });
}); });
it('dispatches status request with job data', done => { it('dispatches status request with job data', (done) => {
testAction( testAction(
actions.requestCreateProject, actions.requestCreateProject,
null, null,
...@@ -75,7 +75,7 @@ describe('self monitor actions', () => { ...@@ -75,7 +75,7 @@ describe('self monitor actions', () => {
); );
}); });
it('dispatches success with project path', done => { it('dispatches success with project path', (done) => {
testAction( testAction(
actions.requestCreateProjectStatus, actions.requestCreateProjectStatus,
null, null,
...@@ -98,7 +98,7 @@ describe('self monitor actions', () => { ...@@ -98,7 +98,7 @@ describe('self monitor actions', () => {
mock.onPost(state.createProjectEndpoint).reply(500); mock.onPost(state.createProjectEndpoint).reply(500);
}); });
it('dispatches error', done => { it('dispatches error', (done) => {
testAction( testAction(
actions.requestCreateProject, actions.requestCreateProject,
null, null,
...@@ -121,7 +121,7 @@ describe('self monitor actions', () => { ...@@ -121,7 +121,7 @@ describe('self monitor actions', () => {
}); });
describe('requestCreateProjectSuccess', () => { describe('requestCreateProjectSuccess', () => {
it('should commit the received data', done => { it('should commit the received data', (done) => {
testAction( testAction(
actions.requestCreateProjectSuccess, actions.requestCreateProjectSuccess,
{ project_full_path: '/self-monitor-url' }, { project_full_path: '/self-monitor-url' },
...@@ -165,7 +165,7 @@ describe('self monitor actions', () => { ...@@ -165,7 +165,7 @@ describe('self monitor actions', () => {
}); });
}); });
it('dispatches status request with job data', done => { it('dispatches status request with job data', (done) => {
testAction( testAction(
actions.requestDeleteProject, actions.requestDeleteProject,
null, null,
...@@ -186,7 +186,7 @@ describe('self monitor actions', () => { ...@@ -186,7 +186,7 @@ describe('self monitor actions', () => {
); );
}); });
it('dispatches success with status', done => { it('dispatches success with status', (done) => {
testAction( testAction(
actions.requestDeleteProjectStatus, actions.requestDeleteProjectStatus,
null, null,
...@@ -209,7 +209,7 @@ describe('self monitor actions', () => { ...@@ -209,7 +209,7 @@ describe('self monitor actions', () => {
mock.onDelete(state.deleteProjectEndpoint).reply(500); mock.onDelete(state.deleteProjectEndpoint).reply(500);
}); });
it('dispatches error', done => { it('dispatches error', (done) => {
testAction( testAction(
actions.requestDeleteProject, actions.requestDeleteProject,
null, null,
...@@ -232,7 +232,7 @@ describe('self monitor actions', () => { ...@@ -232,7 +232,7 @@ describe('self monitor actions', () => {
}); });
describe('requestDeleteProjectSuccess', () => { describe('requestDeleteProjectSuccess', () => {
it('should commit mutations to remove previously set data', done => { it('should commit mutations to remove previously set data', (done) => {
testAction( testAction(
actions.requestDeleteProjectSuccess, actions.requestDeleteProjectSuccess,
null, null,
......
...@@ -4,7 +4,7 @@ import SentryConfig from '~/sentry/sentry_config'; ...@@ -4,7 +4,7 @@ import SentryConfig from '~/sentry/sentry_config';
describe('SentryConfig', () => { describe('SentryConfig', () => {
describe('IGNORE_ERRORS', () => { describe('IGNORE_ERRORS', () => {
it('should be an array of strings', () => { it('should be an array of strings', () => {
const areStrings = SentryConfig.IGNORE_ERRORS.every(error => typeof error === 'string'); const areStrings = SentryConfig.IGNORE_ERRORS.every((error) => typeof error === 'string');
expect(areStrings).toBe(true); expect(areStrings).toBe(true);
}); });
...@@ -12,7 +12,7 @@ describe('SentryConfig', () => { ...@@ -12,7 +12,7 @@ describe('SentryConfig', () => {
describe('BLACKLIST_URLS', () => { describe('BLACKLIST_URLS', () => {
it('should be an array of regexps', () => { it('should be an array of regexps', () => {
const areRegExps = SentryConfig.BLACKLIST_URLS.every(url => url instanceof RegExp); const areRegExps = SentryConfig.BLACKLIST_URLS.every((url) => url instanceof RegExp);
expect(areRegExps).toBe(true); expect(areRegExps).toBe(true);
}); });
......
...@@ -34,7 +34,7 @@ describe('Area component', () => { ...@@ -34,7 +34,7 @@ describe('Area component', () => {
describe('methods', () => { describe('methods', () => {
describe('formatTooltipText', () => { describe('formatTooltipText', () => {
const mockDate = mockNormalizedMetrics.queries[0].result[0].values[0].time; const mockDate = mockNormalizedMetrics.queries[0].result[0].values[0].time;
const generateSeriesData = type => ({ const generateSeriesData = (type) => ({
seriesData: [ seriesData: [
{ {
componentSubType: type, componentSubType: type,
...@@ -91,7 +91,7 @@ describe('Area component', () => { ...@@ -91,7 +91,7 @@ describe('Area component', () => {
expect( expect(
data.filter( data.filter(
datum => new Date(datum.time).getTime() > 0 && typeof datum.value === 'number', (datum) => new Date(datum.time).getTime() > 0 && typeof datum.value === 'number',
).length, ).length,
).toBe(data.length); ).toBe(data.length);
}); });
......
...@@ -7,7 +7,7 @@ import { mockServerlessFunction } from '../mock_data'; ...@@ -7,7 +7,7 @@ import { mockServerlessFunction } from '../mock_data';
describe('functionRowComponent', () => { describe('functionRowComponent', () => {
let wrapper; let wrapper;
const createComponent = func => { const createComponent = (func) => {
wrapper = shallowMount(functionRowComponent, { wrapper = shallowMount(functionRowComponent, {
propsData: { func }, propsData: { func },
}); });
......
...@@ -6,7 +6,7 @@ import missingPrometheusComponent from '~/serverless/components/missing_promethe ...@@ -6,7 +6,7 @@ import missingPrometheusComponent from '~/serverless/components/missing_promethe
describe('missingPrometheusComponent', () => { describe('missingPrometheusComponent', () => {
let wrapper; let wrapper;
const createComponent = missingData => { const createComponent = (missingData) => {
const store = createStore({ clustersPath: '/clusters', helpPath: '/help' }); const store = createStore({ clustersPath: '/clusters', helpPath: '/help' });
wrapper = shallowMount(missingPrometheusComponent, { store, propsData: { missingData } }); wrapper = shallowMount(missingPrometheusComponent, { store, propsData: { missingData } });
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import podBoxComponent from '~/serverless/components/pod_box.vue'; import podBoxComponent from '~/serverless/components/pod_box.vue';
const createComponent = count => const createComponent = (count) =>
shallowMount(podBoxComponent, { shallowMount(podBoxComponent, {
propsData: { propsData: {
count, count,
......
...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import urlComponent from '~/serverless/components/url.vue'; import urlComponent from '~/serverless/components/url.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
const createComponent = uri => const createComponent = (uri) =>
shallowMount(Vue.extend(urlComponent), { shallowMount(Vue.extend(urlComponent), {
propsData: { propsData: {
uri, uri,
......
...@@ -8,7 +8,7 @@ import { adjustMetricQuery } from '../utils'; ...@@ -8,7 +8,7 @@ import { adjustMetricQuery } from '../utils';
describe('ServerlessActions', () => { describe('ServerlessActions', () => {
describe('fetchFunctions', () => { describe('fetchFunctions', () => {
it('should successfully fetch functions', done => { it('should successfully fetch functions', (done) => {
const endpoint = '/functions'; const endpoint = '/functions';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockServerlessFunctions)); mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockServerlessFunctions));
...@@ -29,12 +29,12 @@ describe('ServerlessActions', () => { ...@@ -29,12 +29,12 @@ describe('ServerlessActions', () => {
); );
}); });
it('should successfully retry', done => { it('should successfully retry', (done) => {
const endpoint = '/functions'; const endpoint = '/functions';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock mock
.onGet(endpoint) .onGet(endpoint)
.reply(() => new Promise(resolve => setTimeout(() => resolve(200), Infinity))); .reply(() => new Promise((resolve) => setTimeout(() => resolve(200), Infinity)));
testAction( testAction(
fetchFunctions, fetchFunctions,
...@@ -51,7 +51,7 @@ describe('ServerlessActions', () => { ...@@ -51,7 +51,7 @@ describe('ServerlessActions', () => {
}); });
describe('fetchMetrics', () => { describe('fetchMetrics', () => {
it('should return no prometheus', done => { it('should return no prometheus', (done) => {
const endpoint = '/metrics'; const endpoint = '/metrics';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.NO_CONTENT); mock.onGet(endpoint).reply(statusCodes.NO_CONTENT);
...@@ -69,7 +69,7 @@ describe('ServerlessActions', () => { ...@@ -69,7 +69,7 @@ describe('ServerlessActions', () => {
); );
}); });
it('should successfully fetch metrics', done => { it('should successfully fetch metrics', (done) => {
const endpoint = '/metrics'; const endpoint = '/metrics';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockMetrics)); mock.onGet(endpoint).reply(statusCodes.OK, JSON.stringify(mockMetrics));
......
export const adjustMetricQuery = data => { export const adjustMetricQuery = (data) => {
const updatedMetric = data.metrics; const updatedMetric = data.metrics;
const queries = data.metrics.queries.map(query => ({ const queries = data.metrics.queries.map((query) => ({
...query, ...query,
result: query.result.map(result => ({ result: query.result.map((result) => ({
...result, ...result,
values: result.values.map(([timestamp, value]) => ({ values: result.values.map(([timestamp, value]) => ({
time: new Date(timestamp * 1000).toISOString(), time: new Date(timestamp * 1000).toISOString(),
......
...@@ -40,7 +40,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -40,7 +40,7 @@ describe('SetStatusModalWrapper', () => {
}; };
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.find(GlModal);
const findFormField = field => wrapper.find(`[name="user[status][${field}]"]`); const findFormField = (field) => wrapper.find(`[name="user[status][${field}]"]`);
const findClearStatusButton = () => wrapper.find('.js-clear-user-status-button'); const findClearStatusButton = () => wrapper.find('.js-clear-user-status-button');
const findNoEmojiPlaceholder = () => wrapper.find('.js-no-emoji-placeholder'); const findNoEmojiPlaceholder = () => wrapper.find('.js-no-emoji-placeholder');
const findToggleEmojiButton = () => wrapper.find('.js-toggle-emoji-menu'); const findToggleEmojiButton = () => wrapper.find('.js-toggle-emoji-menu');
......
...@@ -22,14 +22,14 @@ describe('popover', () => { ...@@ -22,14 +22,14 @@ describe('popover', () => {
expect(togglePopover.call(context, true)).toEqual(false); expect(togglePopover.call(context, true)).toEqual(false);
}); });
it('shows popover', done => { it('shows popover', (done) => {
const context = { const context = {
hasClass: () => false, hasClass: () => false,
popover: () => {}, popover: () => {},
toggleClass: () => {}, toggleClass: () => {},
}; };
jest.spyOn(context, 'popover').mockImplementation(method => { jest.spyOn(context, 'popover').mockImplementation((method) => {
expect(method).toEqual('show'); expect(method).toEqual('show');
done(); done();
}); });
...@@ -37,7 +37,7 @@ describe('popover', () => { ...@@ -37,7 +37,7 @@ describe('popover', () => {
togglePopover.call(context, true); togglePopover.call(context, true);
}); });
it('adds disable-animation and js-popover-show class', done => { it('adds disable-animation and js-popover-show class', (done) => {
const context = { const context = {
hasClass: () => false, hasClass: () => false,
popover: () => {}, popover: () => {},
...@@ -73,14 +73,14 @@ describe('popover', () => { ...@@ -73,14 +73,14 @@ describe('popover', () => {
expect(togglePopover.call(context, false)).toEqual(false); expect(togglePopover.call(context, false)).toEqual(false);
}); });
it('hides popover', done => { it('hides popover', (done) => {
const context = { const context = {
hasClass: () => true, hasClass: () => true,
popover: () => {}, popover: () => {},
toggleClass: () => {}, toggleClass: () => {},
}; };
jest.spyOn(context, 'popover').mockImplementation(method => { jest.spyOn(context, 'popover').mockImplementation((method) => {
expect(method).toEqual('hide'); expect(method).toEqual('hide');
done(); done();
}); });
...@@ -88,7 +88,7 @@ describe('popover', () => { ...@@ -88,7 +88,7 @@ describe('popover', () => {
togglePopover.call(context, false); togglePopover.call(context, false);
}); });
it('removes disable-animation and js-popover-show class', done => { it('removes disable-animation and js-popover-show class', (done) => {
const context = { const context = {
hasClass: () => true, hasClass: () => true,
popover: () => {}, popover: () => {},
...@@ -114,7 +114,7 @@ describe('popover', () => { ...@@ -114,7 +114,7 @@ describe('popover', () => {
jest jest
.spyOn($.fn, 'init') .spyOn($.fn, 'init')
.mockImplementation(selector => (selector === '.popover:hover' ? fakeJquery : $.fn)); .mockImplementation((selector) => (selector === '.popover:hover' ? fakeJquery : $.fn));
jest.spyOn(togglePopover, 'call').mockImplementation(() => {}); jest.spyOn(togglePopover, 'call').mockImplementation(() => {});
mouseleave(); mouseleave();
...@@ -128,7 +128,7 @@ describe('popover', () => { ...@@ -128,7 +128,7 @@ describe('popover', () => {
jest jest
.spyOn($.fn, 'init') .spyOn($.fn, 'init')
.mockImplementation(selector => (selector === '.popover:hover' ? fakeJquery : $.fn)); .mockImplementation((selector) => (selector === '.popover:hover' ? fakeJquery : $.fn));
jest.spyOn(togglePopover, 'call').mockImplementation(() => {}); jest.spyOn(togglePopover, 'call').mockImplementation(() => {});
mouseleave(); mouseleave();
...@@ -146,9 +146,9 @@ describe('popover', () => { ...@@ -146,9 +146,9 @@ describe('popover', () => {
expect(togglePopover.call).toHaveBeenCalledWith(expect.any(Object), true); expect(togglePopover.call).toHaveBeenCalledWith(expect.any(Object), true);
}); });
it('registers mouseleave event if popover is showed', done => { it('registers mouseleave event if popover is showed', (done) => {
jest.spyOn(togglePopover, 'call').mockReturnValue(true); jest.spyOn(togglePopover, 'call').mockReturnValue(true);
jest.spyOn($.fn, 'on').mockImplementation(eventName => { jest.spyOn($.fn, 'on').mockImplementation((eventName) => {
expect(eventName).toEqual('mouseleave'); expect(eventName).toEqual('mouseleave');
done(); done();
}); });
......
...@@ -85,13 +85,13 @@ describe('Shortcuts', () => { ...@@ -85,13 +85,13 @@ describe('Shortcuts', () => {
}); });
it('attaches a Mousetrap handler for every markdown shortcut specified with md-shortcuts', () => { it('attaches a Mousetrap handler for every markdown shortcut specified with md-shortcuts', () => {
const expectedCalls = shortcuts.map(s => [s, expect.any(Function)]); const expectedCalls = shortcuts.map((s) => [s, expect.any(Function)]);
expect(mockMousetrap.bind.mock.calls).toEqual(expectedCalls); expect(mockMousetrap.bind.mock.calls).toEqual(expectedCalls);
}); });
it('attaches a stopCallback that allows each markdown shortcut specified with md-shortcuts', () => { it('attaches a stopCallback that allows each markdown shortcut specified with md-shortcuts', () => {
flatten(shortcuts).forEach(s => { flatten(shortcuts).forEach((s) => {
expect(mockMousetrap.stopCallback(null, null, s)).toBe(false); expect(mockMousetrap.stopCallback(null, null, s)).toBe(false);
}); });
}); });
...@@ -108,7 +108,7 @@ describe('Shortcuts', () => { ...@@ -108,7 +108,7 @@ describe('Shortcuts', () => {
Shortcuts.initMarkdownEditorShortcuts($('.edit-note textarea')); Shortcuts.initMarkdownEditorShortcuts($('.edit-note textarea'));
Shortcuts.removeMarkdownEditorShortcuts($('.edit-note textarea')); Shortcuts.removeMarkdownEditorShortcuts($('.edit-note textarea'));
const expectedCalls = shortcuts.map(s => [s]); const expectedCalls = shortcuts.map((s) => [s]);
expect(mockMousetrap.unbind.mock.calls).toEqual(expectedCalls); expect(mockMousetrap.unbind.mock.calls).toEqual(expectedCalls);
}); });
......
...@@ -6,7 +6,7 @@ import Component from '~/sidebar/components/assignees/assignee_title.vue'; ...@@ -6,7 +6,7 @@ import Component from '~/sidebar/components/assignees/assignee_title.vue';
describe('AssigneeTitle component', () => { describe('AssigneeTitle component', () => {
let wrapper; let wrapper;
const createComponent = props => { const createComponent = (props) => {
return shallowMount(Component, { return shallowMount(Component, {
propsData: { propsData: {
numberOfAssignees: 0, numberOfAssignees: 0,
......
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