Commit 89ba3161 authored by Lukas Eipert's avatar Lukas Eipert Committed by Mike Greiling

Use Object spread over Object.assign in spec/

See https://gitlab.com/gitlab-org/gitlab/-/issues/202172

This is part of multiple merge requests in order to reduce the risk of
breaking master
parent aa41d80d
...@@ -15,7 +15,7 @@ describe('Api', () => { ...@@ -15,7 +15,7 @@ describe('Api', () => {
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
originalGon = window.gon; originalGon = window.gon;
window.gon = Object.assign({}, dummyGon); window.gon = { ...dummyGon };
}); });
afterEach(() => { afterEach(() => {
......
...@@ -38,7 +38,7 @@ describe('Blob Content component', () => { ...@@ -38,7 +38,7 @@ describe('Blob Content component', () => {
it('renders error if there is any in the viewer', () => { it('renders error if there is any in the viewer', () => {
const renderError = 'Oops'; const renderError = 'Oops';
const viewer = Object.assign({}, SimpleViewerMock, { renderError }); const viewer = { ...SimpleViewerMock, renderError };
createComponent({}, viewer); createComponent({}, viewer);
expect(wrapper.contains(GlLoadingIcon)).toBe(false); expect(wrapper.contains(GlLoadingIcon)).toBe(false);
expect(wrapper.contains(BlobContentError)).toBe(true); expect(wrapper.contains(BlobContentError)).toBe(true);
......
...@@ -15,7 +15,7 @@ describe('Blob Header Filepath', () => { ...@@ -15,7 +15,7 @@ describe('Blob Header Filepath', () => {
function createComponent(blobProps = {}, options = {}) { function createComponent(blobProps = {}, options = {}) {
wrapper = shallowMount(BlobHeaderFilepath, { wrapper = shallowMount(BlobHeaderFilepath, {
propsData: { propsData: {
blob: Object.assign({}, MockBlob, blobProps), blob: { ...MockBlob, ...blobProps },
}, },
...options, ...options,
}); });
......
...@@ -13,7 +13,7 @@ describe('Blob Header Default Actions', () => { ...@@ -13,7 +13,7 @@ describe('Blob Header Default Actions', () => {
const method = shouldMount ? mount : shallowMount; const method = shouldMount ? mount : shallowMount;
wrapper = method.call(this, BlobHeader, { wrapper = method.call(this, BlobHeader, {
propsData: { propsData: {
blob: Object.assign({}, Blob, blobProps), blob: { ...Blob, ...blobProps },
...propsData, ...propsData,
}, },
...options, ...options,
......
...@@ -64,7 +64,7 @@ describe('Board list component', () => { ...@@ -64,7 +64,7 @@ describe('Board list component', () => {
let getIssues; let getIssues;
function generateIssues(compWrapper) { function generateIssues(compWrapper) {
for (let i = 1; i < 20; i += 1) { for (let i = 1; i < 20; i += 1) {
const issue = Object.assign({}, compWrapper.list.issues[0]); const issue = { ...compWrapper.list.issues[0] };
issue.id += i; issue.id += i;
compWrapper.list.issues.push(issue); compWrapper.list.issues.push(issue);
} }
......
...@@ -93,7 +93,7 @@ describe('KnativeDomainEditor', () => { ...@@ -93,7 +93,7 @@ describe('KnativeDomainEditor', () => {
it('displays toast indicating a successful update', () => { it('displays toast indicating a successful update', () => {
wrapper.vm.$toast = { show: jest.fn() }; wrapper.vm.$toast = { show: jest.fn() };
wrapper.setProps({ knative: Object.assign({ updateSuccessful: true }, knative) }); wrapper.setProps({ knative: { updateSuccessful: true, ...knative } });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.$toast.show).toHaveBeenCalledWith( expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(
......
...@@ -118,7 +118,7 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -118,7 +118,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
let pipelineCopy; let pipelineCopy;
beforeEach(() => { beforeEach(() => {
pipelineCopy = Object.assign({}, pipeline); pipelineCopy = { ...pipeline };
}); });
describe('when latest pipeline has detached flag and canRunPipeline is true', () => { describe('when latest pipeline has detached flag and canRunPipeline is true', () => {
...@@ -128,12 +128,7 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -128,12 +128,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
mock.onGet('endpoint.json').reply(200, [pipelineCopy]); mock.onGet('endpoint.json').reply(200, [pipelineCopy]);
vm = mountComponent( vm = mountComponent(PipelinesTable, { ...props, canRunPipeline: true });
PipelinesTable,
Object.assign({}, props, {
canRunPipeline: true,
}),
);
setImmediate(() => { setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).not.toBeNull(); expect(vm.$el.querySelector('.js-run-mr-pipeline')).not.toBeNull();
...@@ -149,12 +144,7 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -149,12 +144,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
mock.onGet('endpoint.json').reply(200, [pipelineCopy]); mock.onGet('endpoint.json').reply(200, [pipelineCopy]);
vm = mountComponent( vm = mountComponent(PipelinesTable, { ...props, canRunPipeline: false });
PipelinesTable,
Object.assign({}, props, {
canRunPipeline: false,
}),
);
setImmediate(() => { setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull(); expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
...@@ -170,12 +160,7 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -170,12 +160,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
mock.onGet('endpoint.json').reply(200, [pipelineCopy]); mock.onGet('endpoint.json').reply(200, [pipelineCopy]);
vm = mountComponent( vm = mountComponent(PipelinesTable, { ...props, canRunPipeline: true });
PipelinesTable,
Object.assign({}, props, {
canRunPipeline: true,
}),
);
setImmediate(() => { setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull(); expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
...@@ -191,12 +176,7 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -191,12 +176,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
mock.onGet('endpoint.json').reply(200, [pipelineCopy]); mock.onGet('endpoint.json').reply(200, [pipelineCopy]);
vm = mountComponent( vm = mountComponent(PipelinesTable, { ...props, canRunPipeline: false });
PipelinesTable,
Object.assign({}, props, {
canRunPipeline: false,
}),
);
setImmediate(() => { setImmediate(() => {
expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull(); expect(vm.$el.querySelector('.js-run-mr-pipeline')).toBeNull();
...@@ -211,14 +191,12 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -211,14 +191,12 @@ describe('Pipelines table in Commits and Merge requests', () => {
mock.onGet('endpoint.json').reply(200, [pipelineCopy]); mock.onGet('endpoint.json').reply(200, [pipelineCopy]);
vm = mountComponent( vm = mountComponent(PipelinesTable, {
PipelinesTable, ...props,
Object.assign({}, props, { canRunPipeline: true,
canRunPipeline: true, projectId: '5',
projectId: '5', mergeRequestId: 3,
mergeRequestId: 3, });
}),
);
}); });
it('updates the loading state', done => { it('updates the loading state', done => {
......
...@@ -13,7 +13,7 @@ const localVue = createLocalVue(); ...@@ -13,7 +13,7 @@ const localVue = createLocalVue();
describe('DiffDiscussions', () => { describe('DiffDiscussions', () => {
let store; let store;
let wrapper; let wrapper;
const getDiscussionsMockData = () => [Object.assign({}, discussionsMockData)]; const getDiscussionsMockData = () => [{ ...discussionsMockData }];
const createComponent = props => { const createComponent = props => {
store = createStore(); store = createStore();
......
...@@ -81,7 +81,7 @@ describe('DiffExpansionCell', () => { ...@@ -81,7 +81,7 @@ describe('DiffExpansionCell', () => {
isTop: false, isTop: false,
isBottom: false, isBottom: false,
}; };
const props = Object.assign({}, defaults, options); const props = { ...defaults, ...options };
vm = createComponentWithStore(cmp, store, props).$mount(); vm = createComponentWithStore(cmp, store, props).$mount();
}; };
......
...@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import DiffGutterAvatars from '~/diffs/components/diff_gutter_avatars.vue'; import DiffGutterAvatars from '~/diffs/components/diff_gutter_avatars.vue';
import discussionsMockData from '../mock_data/diff_discussions'; import discussionsMockData from '../mock_data/diff_discussions';
const getDiscussionsMockData = () => [Object.assign({}, discussionsMockData)]; const getDiscussionsMockData = () => [{ ...discussionsMockData }];
describe('DiffGutterAvatars', () => { describe('DiffGutterAvatars', () => {
let wrapper; let wrapper;
......
...@@ -9,7 +9,7 @@ describe('DiffLineNoteForm', () => { ...@@ -9,7 +9,7 @@ describe('DiffLineNoteForm', () => {
let wrapper; let wrapper;
let diffFile; let diffFile;
let diffLines; let diffLines;
const getDiffFileMock = () => Object.assign({}, diffFileMockData); const getDiffFileMock = () => ({ ...diffFileMockData });
beforeEach(() => { beforeEach(() => {
diffFile = getDiffFileMock(); diffFile = getDiffFileMock();
......
...@@ -16,7 +16,7 @@ describe('InlineDiffExpansionRow', () => { ...@@ -16,7 +16,7 @@ describe('InlineDiffExpansionRow', () => {
isTop: false, isTop: false,
isBottom: false, isBottom: false,
}; };
const props = Object.assign({}, defaults, options); const props = { ...defaults, ...options };
return createComponentWithStore(cmp, createStore(), props).$mount(); return createComponentWithStore(cmp, createStore(), props).$mount();
}; };
......
...@@ -8,8 +8,8 @@ import discussionsMockData from '../mock_data/diff_discussions'; ...@@ -8,8 +8,8 @@ import discussionsMockData from '../mock_data/diff_discussions';
describe('InlineDiffView', () => { describe('InlineDiffView', () => {
let component; let component;
const getDiffFileMock = () => Object.assign({}, diffFileMockData); const getDiffFileMock = () => ({ ...diffFileMockData });
const getDiscussionsMockData = () => [Object.assign({}, discussionsMockData)]; const getDiscussionsMockData = () => [{ ...discussionsMockData }];
const notesLength = getDiscussionsMockData()[0].notes.length; const notesLength = getDiscussionsMockData()[0].notes.length;
beforeEach(done => { beforeEach(done => {
......
...@@ -16,7 +16,7 @@ describe('ParallelDiffExpansionRow', () => { ...@@ -16,7 +16,7 @@ describe('ParallelDiffExpansionRow', () => {
isTop: false, isTop: false,
isBottom: false, isBottom: false,
}; };
const props = Object.assign({}, defaults, options); const props = { ...defaults, ...options };
return createComponentWithStore(cmp, createStore(), props).$mount(); return createComponentWithStore(cmp, createStore(), props).$mount();
}; };
......
...@@ -7,7 +7,7 @@ import diffFileMockData from '../mock_data/diff_file'; ...@@ -7,7 +7,7 @@ import diffFileMockData from '../mock_data/diff_file';
describe('ParallelDiffView', () => { describe('ParallelDiffView', () => {
let component; let component;
const getDiffFileMock = () => Object.assign({}, diffFileMockData); const getDiffFileMock = () => ({ ...diffFileMockData });
beforeEach(() => { beforeEach(() => {
const diffFile = getDiffFileMock(); const diffFile = getDiffFileMock();
......
...@@ -14,10 +14,10 @@ describe('Diffs Module Getters', () => { ...@@ -14,10 +14,10 @@ describe('Diffs Module Getters', () => {
beforeEach(() => { beforeEach(() => {
localState = state(); localState = state();
discussionMock = Object.assign({}, discussion); discussionMock = { ...discussion };
discussionMock.diff_file.file_hash = diffFileMock.fileHash; discussionMock.diff_file.file_hash = diffFileMock.fileHash;
discussionMock1 = Object.assign({}, discussion); discussionMock1 = { ...discussion };
discussionMock1.diff_file.file_hash = diffFileMock.fileHash; discussionMock1.diff_file.file_hash = diffFileMock.fileHash;
}); });
......
...@@ -372,13 +372,13 @@ describe('DiffsStoreUtils', () => { ...@@ -372,13 +372,13 @@ describe('DiffsStoreUtils', () => {
mock = getDiffFileMock(); mock = getDiffFileMock();
preparedDiff = { diff_files: [mock] }; preparedDiff = { diff_files: [mock] };
splitInlineDiff = { splitInlineDiff = {
diff_files: [Object.assign({}, mock, { parallel_diff_lines: undefined })], diff_files: [{ ...mock, parallel_diff_lines: undefined }],
}; };
splitParallelDiff = { splitParallelDiff = {
diff_files: [Object.assign({}, mock, { highlighted_diff_lines: undefined })], diff_files: [{ ...mock, highlighted_diff_lines: undefined }],
}; };
completedDiff = { completedDiff = {
diff_files: [Object.assign({}, mock, { highlighted_diff_lines: undefined })], diff_files: [{ ...mock, highlighted_diff_lines: undefined }],
}; };
preparedDiff.diff_files = utils.prepareDiffData(preparedDiff); preparedDiff.diff_files = utils.prepareDiffData(preparedDiff);
......
...@@ -216,7 +216,7 @@ describe('AppComponent', () => { ...@@ -216,7 +216,7 @@ describe('AppComponent', () => {
let groupItem; let groupItem;
beforeEach(() => { beforeEach(() => {
groupItem = Object.assign({}, mockParentGroupItem); groupItem = { ...mockParentGroupItem };
groupItem.isOpen = false; groupItem.isOpen = false;
groupItem.isChildrenLoading = false; groupItem.isChildrenLoading = false;
}); });
...@@ -271,7 +271,7 @@ describe('AppComponent', () => { ...@@ -271,7 +271,7 @@ describe('AppComponent', () => {
describe('showLeaveGroupModal', () => { describe('showLeaveGroupModal', () => {
it('caches candidate group (as props) which is to be left', () => { it('caches candidate group (as props) which is to be left', () => {
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
expect(vm.targetGroup).toBe(null); expect(vm.targetGroup).toBe(null);
expect(vm.targetParentGroup).toBe(null); expect(vm.targetParentGroup).toBe(null);
...@@ -282,7 +282,7 @@ describe('AppComponent', () => { ...@@ -282,7 +282,7 @@ describe('AppComponent', () => {
}); });
it('updates props which show modal confirmation dialog', () => { it('updates props which show modal confirmation dialog', () => {
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
expect(vm.showModal).toBe(false); expect(vm.showModal).toBe(false);
expect(vm.groupLeaveConfirmationMessage).toBe(''); expect(vm.groupLeaveConfirmationMessage).toBe('');
...@@ -297,7 +297,7 @@ describe('AppComponent', () => { ...@@ -297,7 +297,7 @@ describe('AppComponent', () => {
describe('hideLeaveGroupModal', () => { describe('hideLeaveGroupModal', () => {
it('hides modal confirmation which is shown before leaving the group', () => { it('hides modal confirmation which is shown before leaving the group', () => {
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
vm.showLeaveGroupModal(group, mockParentGroupItem); vm.showLeaveGroupModal(group, mockParentGroupItem);
expect(vm.showModal).toBe(true); expect(vm.showModal).toBe(true);
...@@ -312,7 +312,7 @@ describe('AppComponent', () => { ...@@ -312,7 +312,7 @@ describe('AppComponent', () => {
let childGroupItem; let childGroupItem;
beforeEach(() => { beforeEach(() => {
groupItem = Object.assign({}, mockParentGroupItem); groupItem = { ...mockParentGroupItem };
groupItem.children = mockChildren; groupItem.children = mockChildren;
[childGroupItem] = groupItem.children; [childGroupItem] = groupItem.children;
groupItem.isChildrenLoading = false; groupItem.isChildrenLoading = false;
......
...@@ -52,7 +52,7 @@ describe('GroupFolderComponent', () => { ...@@ -52,7 +52,7 @@ describe('GroupFolderComponent', () => {
}); });
it('should render more children link when groups list has children over MAX_CHILDREN_COUNT limit', () => { it('should render more children link when groups list has children over MAX_CHILDREN_COUNT limit', () => {
const parentGroup = Object.assign({}, mockParentGroupItem); const parentGroup = { ...mockParentGroupItem };
parentGroup.childrenCount = 21; parentGroup.childrenCount = 21;
const newVm = createComponent(mockGroups, parentGroup); const newVm = createComponent(mockGroups, parentGroup);
......
...@@ -52,7 +52,7 @@ describe('GroupItemComponent', () => { ...@@ -52,7 +52,7 @@ describe('GroupItemComponent', () => {
describe('hasChildren', () => { describe('hasChildren', () => {
it('should return boolean value representing if group has any children present', () => { it('should return boolean value representing if group has any children present', () => {
let newVm; let newVm;
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.childrenCount = 5; group.childrenCount = 5;
newVm = createComponent(group); newVm = createComponent(group);
...@@ -71,7 +71,7 @@ describe('GroupItemComponent', () => { ...@@ -71,7 +71,7 @@ describe('GroupItemComponent', () => {
describe('hasAvatar', () => { describe('hasAvatar', () => {
it('should return boolean value representing if group has any avatar present', () => { it('should return boolean value representing if group has any avatar present', () => {
let newVm; let newVm;
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.avatarUrl = null; group.avatarUrl = null;
newVm = createComponent(group); newVm = createComponent(group);
...@@ -90,7 +90,7 @@ describe('GroupItemComponent', () => { ...@@ -90,7 +90,7 @@ describe('GroupItemComponent', () => {
describe('isGroup', () => { describe('isGroup', () => {
it('should return boolean value representing if group item is of type `group` or not', () => { it('should return boolean value representing if group item is of type `group` or not', () => {
let newVm; let newVm;
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.type = 'group'; group.type = 'group';
newVm = createComponent(group); newVm = createComponent(group);
...@@ -138,7 +138,7 @@ describe('GroupItemComponent', () => { ...@@ -138,7 +138,7 @@ describe('GroupItemComponent', () => {
it('should navigate page to group homepage if group does not have any children present', () => { it('should navigate page to group homepage if group does not have any children present', () => {
jest.spyOn(urlUtilities, 'visitUrl').mockImplementation(); jest.spyOn(urlUtilities, 'visitUrl').mockImplementation();
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.childrenCount = 0; group.childrenCount = 0;
const newVm = createComponent(group); const newVm = createComponent(group);
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
......
...@@ -46,7 +46,7 @@ describe('ItemActionsComponent', () => { ...@@ -46,7 +46,7 @@ describe('ItemActionsComponent', () => {
}); });
it('should render Edit Group button with correct attribute values', () => { it('should render Edit Group button with correct attribute values', () => {
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.canEdit = true; group.canEdit = true;
const newVm = createComponent(group); const newVm = createComponent(group);
...@@ -64,7 +64,7 @@ describe('ItemActionsComponent', () => { ...@@ -64,7 +64,7 @@ describe('ItemActionsComponent', () => {
}); });
it('should render Leave Group button with correct attribute values', () => { it('should render Leave Group button with correct attribute values', () => {
const group = Object.assign({}, mockParentGroupItem); const group = { ...mockParentGroupItem };
group.canLeave = true; group.canLeave = true;
const newVm = createComponent(group); const newVm = createComponent(group);
......
...@@ -23,7 +23,7 @@ describe('ItemStatsComponent', () => { ...@@ -23,7 +23,7 @@ describe('ItemStatsComponent', () => {
describe('visibilityIcon', () => { describe('visibilityIcon', () => {
it('should return icon class based on `item.visibility` value', () => { it('should return icon class based on `item.visibility` value', () => {
Object.keys(VISIBILITY_TYPE_ICON).forEach(visibility => { Object.keys(VISIBILITY_TYPE_ICON).forEach(visibility => {
const item = Object.assign({}, mockParentGroupItem, { visibility }); const item = { ...mockParentGroupItem, visibility };
const vm = createComponent(item); const vm = createComponent(item);
expect(vm.visibilityIcon).toBe(VISIBILITY_TYPE_ICON[visibility]); expect(vm.visibilityIcon).toBe(VISIBILITY_TYPE_ICON[visibility]);
...@@ -35,10 +35,7 @@ describe('ItemStatsComponent', () => { ...@@ -35,10 +35,7 @@ describe('ItemStatsComponent', () => {
describe('visibilityTooltip', () => { describe('visibilityTooltip', () => {
it('should return tooltip string for Group based on `item.visibility` value', () => { it('should return tooltip string for Group based on `item.visibility` value', () => {
Object.keys(GROUP_VISIBILITY_TYPE).forEach(visibility => { Object.keys(GROUP_VISIBILITY_TYPE).forEach(visibility => {
const item = Object.assign({}, mockParentGroupItem, { const item = { ...mockParentGroupItem, visibility, type: ITEM_TYPE.GROUP };
visibility,
type: ITEM_TYPE.GROUP,
});
const vm = createComponent(item); const vm = createComponent(item);
expect(vm.visibilityTooltip).toBe(GROUP_VISIBILITY_TYPE[visibility]); expect(vm.visibilityTooltip).toBe(GROUP_VISIBILITY_TYPE[visibility]);
...@@ -48,10 +45,7 @@ describe('ItemStatsComponent', () => { ...@@ -48,10 +45,7 @@ describe('ItemStatsComponent', () => {
it('should return tooltip string for Project based on `item.visibility` value', () => { it('should return tooltip string for Project based on `item.visibility` value', () => {
Object.keys(PROJECT_VISIBILITY_TYPE).forEach(visibility => { Object.keys(PROJECT_VISIBILITY_TYPE).forEach(visibility => {
const item = Object.assign({}, mockParentGroupItem, { const item = { ...mockParentGroupItem, visibility, type: ITEM_TYPE.PROJECT };
visibility,
type: ITEM_TYPE.PROJECT,
});
const vm = createComponent(item); const vm = createComponent(item);
expect(vm.visibilityTooltip).toBe(PROJECT_VISIBILITY_TYPE[visibility]); expect(vm.visibilityTooltip).toBe(PROJECT_VISIBILITY_TYPE[visibility]);
...@@ -65,13 +59,13 @@ describe('ItemStatsComponent', () => { ...@@ -65,13 +59,13 @@ describe('ItemStatsComponent', () => {
let item; let item;
let vm; let vm;
item = Object.assign({}, mockParentGroupItem, { type: ITEM_TYPE.PROJECT }); item = { ...mockParentGroupItem, type: ITEM_TYPE.PROJECT };
vm = createComponent(item); vm = createComponent(item);
expect(vm.isProject).toBeTruthy(); expect(vm.isProject).toBeTruthy();
vm.$destroy(); vm.$destroy();
item = Object.assign({}, mockParentGroupItem, { type: ITEM_TYPE.GROUP }); item = { ...mockParentGroupItem, type: ITEM_TYPE.GROUP };
vm = createComponent(item); vm = createComponent(item);
expect(vm.isProject).toBeFalsy(); expect(vm.isProject).toBeFalsy();
...@@ -84,13 +78,13 @@ describe('ItemStatsComponent', () => { ...@@ -84,13 +78,13 @@ describe('ItemStatsComponent', () => {
let item; let item;
let vm; let vm;
item = Object.assign({}, mockParentGroupItem, { type: ITEM_TYPE.GROUP }); item = { ...mockParentGroupItem, type: ITEM_TYPE.GROUP };
vm = createComponent(item); vm = createComponent(item);
expect(vm.isGroup).toBeTruthy(); expect(vm.isGroup).toBeTruthy();
vm.$destroy(); vm.$destroy();
item = Object.assign({}, mockParentGroupItem, { type: ITEM_TYPE.PROJECT }); item = { ...mockParentGroupItem, type: ITEM_TYPE.PROJECT };
vm = createComponent(item); vm = createComponent(item);
expect(vm.isGroup).toBeFalsy(); expect(vm.isGroup).toBeFalsy();
...@@ -109,10 +103,7 @@ describe('ItemStatsComponent', () => { ...@@ -109,10 +103,7 @@ describe('ItemStatsComponent', () => {
}); });
it('renders start count and last updated information for project item correctly', () => { it('renders start count and last updated information for project item correctly', () => {
const item = Object.assign({}, mockParentGroupItem, { const item = { ...mockParentGroupItem, type: ITEM_TYPE.PROJECT, starCount: 4 };
type: ITEM_TYPE.PROJECT,
starCount: 4,
});
const vm = createComponent(item); const vm = createComponent(item);
const projectStarIconEl = vm.$el.querySelector('.project-stars'); const projectStarIconEl = vm.$el.querySelector('.project-stars');
......
...@@ -27,7 +27,7 @@ describe('ItemStatsValueComponent', () => { ...@@ -27,7 +27,7 @@ describe('ItemStatsValueComponent', () => {
describe('isValuePresent', () => { describe('isValuePresent', () => {
it('returns true if non-empty `value` is present', () => { it('returns true if non-empty `value` is present', () => {
vm = createComponent(Object.assign({}, itemConfig, { value: 10 })); vm = createComponent({ ...itemConfig, value: 10 });
expect(vm.isValuePresent).toBeTruthy(); expect(vm.isValuePresent).toBeTruthy();
}); });
......
...@@ -108,8 +108,8 @@ describe('ProjectsStore', () => { ...@@ -108,8 +108,8 @@ describe('ProjectsStore', () => {
describe('removeGroup', () => { describe('removeGroup', () => {
it('should remove children from group item in state', () => { it('should remove children from group item in state', () => {
const store = new GroupsStore(); const store = new GroupsStore();
const rawParentGroup = Object.assign({}, mockGroups[0]); const rawParentGroup = { ...mockGroups[0] };
const rawChildGroup = Object.assign({}, mockGroups[1]); const rawChildGroup = { ...mockGroups[1] };
store.setGroups([rawParentGroup]); store.setGroups([rawParentGroup]);
store.setGroupChildren(store.state.groups[0], [rawChildGroup]); store.setGroupChildren(store.state.groups[0], [rawChildGroup]);
......
...@@ -15,7 +15,7 @@ describe('IDE review mode', () => { ...@@ -15,7 +15,7 @@ describe('IDE review mode', () => {
store = createStore(); store = createStore();
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master'; store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projectData); store.state.projects.abcproject = { ...projectData };
Vue.set(store.state.trees, 'abcproject/master', { Vue.set(store.state.trees, 'abcproject/master', {
tree: [file('fileName')], tree: [file('fileName')],
loading: false, loading: false,
......
...@@ -10,7 +10,7 @@ function bootstrap(projData) { ...@@ -10,7 +10,7 @@ function bootstrap(projData) {
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master'; store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projData); store.state.projects.abcproject = { ...projData };
Vue.set(store.state.trees, 'abcproject/master', { Vue.set(store.state.trees, 'abcproject/master', {
tree: [], tree: [],
loading: false, loading: false,
...@@ -27,7 +27,7 @@ describe('ide component, empty repo', () => { ...@@ -27,7 +27,7 @@ describe('ide component, empty repo', () => {
let vm; let vm;
beforeEach(() => { beforeEach(() => {
const emptyProjData = Object.assign({}, projectData, { empty_repo: true, branches: {} }); const emptyProjData = { ...projectData, empty_repo: true, branches: {} };
vm = bootstrap(emptyProjData); vm = bootstrap(emptyProjData);
vm.$mount(); vm.$mount();
}); });
......
...@@ -14,7 +14,7 @@ describe('IDE tree list', () => { ...@@ -14,7 +14,7 @@ describe('IDE tree list', () => {
const bootstrapWithTree = (tree = normalBranchTree) => { const bootstrapWithTree = (tree = normalBranchTree) => {
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master'; store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projectData); store.state.projects.abcproject = { ...projectData };
Vue.set(store.state.trees, 'abcproject/master', { Vue.set(store.state.trees, 'abcproject/master', {
tree, tree,
loading: false, loading: false,
......
...@@ -13,7 +13,7 @@ describe('IdeRepoTree', () => { ...@@ -13,7 +13,7 @@ describe('IdeRepoTree', () => {
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master'; store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projectData); store.state.projects.abcproject = { ...projectData };
Vue.set(store.state.trees, 'abcproject/master', { Vue.set(store.state.trees, 'abcproject/master', {
tree: [file('fileName')], tree: [file('fileName')],
loading: false, loading: false,
......
...@@ -17,11 +17,12 @@ describe('ImportProjectsTable', () => { ...@@ -17,11 +17,12 @@ describe('ImportProjectsTable', () => {
}; };
function initStore() { function initStore() {
const stubbedActions = Object.assign({}, actions, { const stubbedActions = {
...actions,
fetchJobs: jest.fn(), fetchJobs: jest.fn(),
fetchRepos: jest.fn(actions.requestRepos), fetchRepos: jest.fn(actions.requestRepos),
fetchImport: jest.fn(actions.requestImport), fetchImport: jest.fn(actions.requestImport),
}); };
const store = new Vuex.Store({ const store = new Vuex.Store({
state: state(), state: state(),
......
...@@ -18,9 +18,7 @@ describe('ProviderRepoTableRow', () => { ...@@ -18,9 +18,7 @@ describe('ProviderRepoTableRow', () => {
}; };
function initStore() { function initStore() {
const stubbedActions = Object.assign({}, actions, { const stubbedActions = { ...actions, fetchImport };
fetchImport,
});
const store = new Vuex.Store({ const store = new Vuex.Store({
state: state(), state: state(),
......
...@@ -13,7 +13,7 @@ describe('ActiveToggle', () => { ...@@ -13,7 +13,7 @@ describe('ActiveToggle', () => {
const createComponent = props => { const createComponent = props => {
wrapper = mount(ActiveToggle, { wrapper = mount(ActiveToggle, {
propsData: Object.assign({}, defaultProps, props), propsData: { ...defaultProps, ...props },
}); });
}; };
......
...@@ -13,7 +13,7 @@ describe('JiraTriggerFields', () => { ...@@ -13,7 +13,7 @@ describe('JiraTriggerFields', () => {
const createComponent = props => { const createComponent = props => {
wrapper = mount(JiraTriggerFields, { wrapper = mount(JiraTriggerFields, {
propsData: Object.assign({}, defaultProps, props), propsData: { ...defaultProps, ...props },
}); });
}; };
......
...@@ -113,12 +113,7 @@ describe('Description component', () => { ...@@ -113,12 +113,7 @@ describe('Description component', () => {
beforeEach(() => { beforeEach(() => {
vm.$destroy(); vm.$destroy();
TaskList.mockClear(); TaskList.mockClear();
vm = mountComponent( vm = mountComponent(DescriptionComponent, { ...props, issuableType: 'issuableType' });
DescriptionComponent,
Object.assign({}, props, {
issuableType: 'issuableType',
}),
);
}); });
it('re-inits the TaskList when description changed', () => { it('re-inits the TaskList when description changed', () => {
......
...@@ -86,7 +86,7 @@ describe('Job Log Header Line', () => { ...@@ -86,7 +86,7 @@ describe('Job Log Header Line', () => {
describe('with duration', () => { describe('with duration', () => {
beforeEach(() => { beforeEach(() => {
createComponent(Object.assign({}, data, { duration: '00:10' })); createComponent({ ...data, duration: '00:10' });
}); });
it('renders the duration badge', () => { it('renders the duration badge', () => {
......
...@@ -59,7 +59,7 @@ describe('Jobs Store Mutations', () => { ...@@ -59,7 +59,7 @@ describe('Jobs Store Mutations', () => {
describe('when traceSize is bigger than the total size', () => { describe('when traceSize is bigger than the total size', () => {
it('sets isTraceSizeVisible to false', () => { it('sets isTraceSizeVisible to false', () => {
const copy = Object.assign({}, stateCopy, { traceSize: 5118460, size: 2321312 }); const copy = { ...stateCopy, traceSize: 5118460, size: 2321312 };
mutations[types.RECEIVE_TRACE_SUCCESS](copy, { total: 511846 }); mutations[types.RECEIVE_TRACE_SUCCESS](copy, { total: 511846 });
......
...@@ -503,7 +503,7 @@ describe('common_utils', () => { ...@@ -503,7 +503,7 @@ describe('common_utils', () => {
beforeEach(() => { beforeEach(() => {
window.gon = window.gon || {}; window.gon = window.gon || {};
beforeGon = Object.assign({}, window.gon); beforeGon = { ...window.gon };
window.gon.sprite_icons = 'icons.svg'; window.gon.sprite_icons = 'icons.svg';
}); });
......
...@@ -138,7 +138,7 @@ describe('noteable_discussion component', () => { ...@@ -138,7 +138,7 @@ describe('noteable_discussion component', () => {
describe('signout widget', () => { describe('signout widget', () => {
beforeEach(() => { beforeEach(() => {
originalGon = Object.assign({}, window.gon); originalGon = { ...window.gon };
window.gon = window.gon || {}; window.gon = window.gon || {};
}); });
......
...@@ -193,7 +193,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -193,7 +193,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$('.js-comment-button').click(); $('.js-comment-button').click();
const $targetNote = $notesContainer.find(`#note_${noteEntity.id}`); const $targetNote = $notesContainer.find(`#note_${noteEntity.id}`);
const updatedNote = Object.assign({}, noteEntity); const updatedNote = { ...noteEntity };
updatedNote.note = 'bar'; updatedNote.note = 'bar';
notes.updateNote(updatedNote, $targetNote); notes.updateNote(updatedNote, $targetNote);
......
...@@ -18,9 +18,7 @@ describe('Collapse utils', () => { ...@@ -18,9 +18,7 @@ describe('Collapse utils', () => {
}); });
it('returns false when a system note is not a description type', () => { it('returns false when a system note is not a description type', () => {
expect(isDescriptionSystemNote(Object.assign({}, mockSystemNote, { note: 'foo' }))).toEqual( expect(isDescriptionSystemNote({ ...mockSystemNote, note: 'foo' })).toEqual(false);
false,
);
}); });
it('gets the time difference between two notes', () => { it('gets the time difference between two notes', () => {
......
...@@ -50,7 +50,7 @@ describe('Notes Store mutations', () => { ...@@ -50,7 +50,7 @@ describe('Notes Store mutations', () => {
}); });
describe('ADD_NEW_REPLY_TO_DISCUSSION', () => { describe('ADD_NEW_REPLY_TO_DISCUSSION', () => {
const newReply = Object.assign({}, note, { discussion_id: discussionMock.id }); const newReply = { ...note, discussion_id: discussionMock.id };
let state; let state;
...@@ -86,7 +86,7 @@ describe('Notes Store mutations', () => { ...@@ -86,7 +86,7 @@ describe('Notes Store mutations', () => {
describe('EXPAND_DISCUSSION', () => { describe('EXPAND_DISCUSSION', () => {
it('should expand a collapsed discussion', () => { it('should expand a collapsed discussion', () => {
const discussion = Object.assign({}, discussionMock, { expanded: false }); const discussion = { ...discussionMock, expanded: false };
const state = { const state = {
discussions: [discussion], discussions: [discussion],
...@@ -100,7 +100,7 @@ describe('Notes Store mutations', () => { ...@@ -100,7 +100,7 @@ describe('Notes Store mutations', () => {
describe('COLLAPSE_DISCUSSION', () => { describe('COLLAPSE_DISCUSSION', () => {
it('should collapse an expanded discussion', () => { it('should collapse an expanded discussion', () => {
const discussion = Object.assign({}, discussionMock, { expanded: true }); const discussion = { ...discussionMock, expanded: true };
const state = { const state = {
discussions: [discussion], discussions: [discussion],
...@@ -114,7 +114,7 @@ describe('Notes Store mutations', () => { ...@@ -114,7 +114,7 @@ describe('Notes Store mutations', () => {
describe('REMOVE_PLACEHOLDER_NOTES', () => { describe('REMOVE_PLACEHOLDER_NOTES', () => {
it('should remove all placeholder notes in indivudal notes and discussion', () => { it('should remove all placeholder notes in indivudal notes and discussion', () => {
const placeholderNote = Object.assign({}, individualNote, { isPlaceholderNote: true }); const placeholderNote = { ...individualNote, isPlaceholderNote: true };
const state = { discussions: [placeholderNote] }; const state = { discussions: [placeholderNote] };
mutations.REMOVE_PLACEHOLDER_NOTES(state); mutations.REMOVE_PLACEHOLDER_NOTES(state);
...@@ -298,7 +298,7 @@ describe('Notes Store mutations', () => { ...@@ -298,7 +298,7 @@ describe('Notes Store mutations', () => {
describe('TOGGLE_DISCUSSION', () => { describe('TOGGLE_DISCUSSION', () => {
it('should open a closed discussion', () => { it('should open a closed discussion', () => {
const discussion = Object.assign({}, discussionMock, { expanded: false }); const discussion = { ...discussionMock, expanded: false };
const state = { const state = {
discussions: [discussion], discussions: [discussion],
...@@ -348,8 +348,8 @@ describe('Notes Store mutations', () => { ...@@ -348,8 +348,8 @@ describe('Notes Store mutations', () => {
}); });
it('should open all closed discussions', () => { it('should open all closed discussions', () => {
const discussion1 = Object.assign({}, discussionMock, { id: 0, expanded: false }); const discussion1 = { ...discussionMock, id: 0, expanded: false };
const discussion2 = Object.assign({}, discussionMock, { id: 1, expanded: true }); const discussion2 = { ...discussionMock, id: 1, expanded: true };
const discussionIds = [discussion1.id, discussion2.id]; const discussionIds = [discussion1.id, discussion2.id];
const state = { discussions: [discussion1, discussion2] }; const state = { discussions: [discussion1, discussion2] };
...@@ -362,8 +362,8 @@ describe('Notes Store mutations', () => { ...@@ -362,8 +362,8 @@ describe('Notes Store mutations', () => {
}); });
it('should close all opened discussions', () => { it('should close all opened discussions', () => {
const discussion1 = Object.assign({}, discussionMock, { id: 0, expanded: false }); const discussion1 = { ...discussionMock, id: 0, expanded: false };
const discussion2 = Object.assign({}, discussionMock, { id: 1, expanded: true }); const discussion2 = { ...discussionMock, id: 1, expanded: true };
const discussionIds = [discussion1.id, discussion2.id]; const discussionIds = [discussion1.id, discussion2.id];
const state = { discussions: [discussion1, discussion2] }; const state = { discussions: [discussion1, discussion2] };
...@@ -382,7 +382,7 @@ describe('Notes Store mutations', () => { ...@@ -382,7 +382,7 @@ describe('Notes Store mutations', () => {
discussions: [individualNote], discussions: [individualNote],
}; };
const updated = Object.assign({}, individualNote.notes[0], { note: 'Foo' }); const updated = { ...individualNote.notes[0], note: 'Foo' };
mutations.UPDATE_NOTE(state, updated); mutations.UPDATE_NOTE(state, updated);
......
...@@ -26,7 +26,7 @@ describe('stage column component', () => { ...@@ -26,7 +26,7 @@ describe('stage column component', () => {
beforeEach(() => { beforeEach(() => {
const mockGroups = []; const mockGroups = [];
for (let i = 0; i < 3; i += 1) { for (let i = 0; i < 3; i += 1) {
const mockedJob = Object.assign({}, mockJob); const mockedJob = { ...mockJob };
mockedJob.id += i; mockedJob.id += i;
mockGroups.push(mockedJob); mockGroups.push(mockedJob);
} }
......
...@@ -601,7 +601,7 @@ describe('Pipelines', () => { ...@@ -601,7 +601,7 @@ describe('Pipelines', () => {
describe('updates results when a staged is clicked', () => { describe('updates results when a staged is clicked', () => {
beforeEach(() => { beforeEach(() => {
const copyPipeline = Object.assign({}, pipelineWithStages); const copyPipeline = { ...pipelineWithStages };
copyPipeline.id += 1; copyPipeline.id += 1;
mock mock
.onGet('twitter/flight/pipelines.json') .onGet('twitter/flight/pipelines.json')
......
...@@ -169,7 +169,7 @@ describe('Pipelines Table Row', () => { ...@@ -169,7 +169,7 @@ describe('Pipelines Table Row', () => {
}; };
beforeEach(() => { beforeEach(() => {
const withActions = Object.assign({}, pipeline); const withActions = { ...pipeline };
withActions.details.scheduled_actions = [scheduledJobAction]; withActions.details.scheduled_actions = [scheduledJobAction];
withActions.flags.cancelable = true; withActions.flags.cancelable = true;
withActions.flags.retryable = true; withActions.flags.retryable = true;
......
...@@ -96,7 +96,7 @@ describe('Pipelines stage component', () => { ...@@ -96,7 +96,7 @@ describe('Pipelines stage component', () => {
describe('update endpoint correctly', () => { describe('update endpoint correctly', () => {
beforeEach(() => { beforeEach(() => {
const copyStage = Object.assign({}, stageReply); const copyStage = { ...stageReply };
copyStage.latest_statuses[0].name = 'this is the updated content'; copyStage.latest_statuses[0].name = 'this is the updated content';
mock.onGet('bar.json').reply(200, copyStage); mock.onGet('bar.json').reply(200, copyStage);
createComponent({ createComponent({
......
...@@ -7,7 +7,7 @@ describe('EE Pipeline store', () => { ...@@ -7,7 +7,7 @@ describe('EE Pipeline store', () => {
beforeEach(() => { beforeEach(() => {
store = new PipelineStore(); store = new PipelineStore();
data = Object.assign({}, LinkedPipelines); data = { ...LinkedPipelines };
store.storePipeline(data); store.storePipeline(data);
}); });
......
...@@ -20,7 +20,7 @@ describe('Mutations TestReports Store', () => { ...@@ -20,7 +20,7 @@ describe('Mutations TestReports Store', () => {
describe('set endpoint', () => { describe('set endpoint', () => {
it('should set endpoint', () => { it('should set endpoint', () => {
const expectedState = Object.assign({}, mockState, { endpoint: 'foo' }); const expectedState = { ...mockState, endpoint: 'foo' };
mutations[types.SET_ENDPOINT](mockState, 'foo'); mutations[types.SET_ENDPOINT](mockState, 'foo');
expect(mockState.endpoint).toEqual(expectedState.endpoint); expect(mockState.endpoint).toEqual(expectedState.endpoint);
...@@ -47,14 +47,14 @@ describe('Mutations TestReports Store', () => { ...@@ -47,14 +47,14 @@ describe('Mutations TestReports Store', () => {
describe('toggle loading', () => { describe('toggle loading', () => {
it('should set to true', () => { it('should set to true', () => {
const expectedState = Object.assign({}, mockState, { isLoading: true }); const expectedState = { ...mockState, isLoading: true };
mutations[types.TOGGLE_LOADING](mockState); mutations[types.TOGGLE_LOADING](mockState);
expect(mockState.isLoading).toEqual(expectedState.isLoading); expect(mockState.isLoading).toEqual(expectedState.isLoading);
}); });
it('should toggle back to false', () => { it('should toggle back to false', () => {
const expectedState = Object.assign({}, mockState, { isLoading: false }); const expectedState = { ...mockState, isLoading: false };
mockState.isLoading = true; mockState.isLoading = true;
mutations[types.TOGGLE_LOADING](mockState); mutations[types.TOGGLE_LOADING](mockState);
......
...@@ -84,9 +84,7 @@ describe('Blob Embeddable', () => { ...@@ -84,9 +84,7 @@ describe('Blob Embeddable', () => {
}); });
it('sets rich viewer correctly', () => { it('sets rich viewer correctly', () => {
const data = Object.assign({}, dataMock, { const data = { ...dataMock, activeViewerType: RichViewerMock.type };
activeViewerType: RichViewerMock.type,
});
createComponent({}, data); createComponent({}, data);
expect(wrapper.find(RichViewer).exists()).toBe(true); expect(wrapper.find(RichViewer).exists()).toBe(true);
}); });
......
...@@ -17,7 +17,7 @@ describe('Snippet header component', () => { ...@@ -17,7 +17,7 @@ describe('Snippet header component', () => {
}; };
function createComponent({ props = snippet } = {}) { function createComponent({ props = snippet } = {}) {
const defaultProps = Object.assign({}, props); const defaultProps = { ...props };
wrapper = shallowMount(SnippetTitle, { wrapper = shallowMount(SnippetTitle, {
propsData: { propsData: {
......
...@@ -46,10 +46,11 @@ describe('Tracking', () => { ...@@ -46,10 +46,11 @@ describe('Tracking', () => {
expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking');
expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking');
window.snowplowOptions = Object.assign({}, window.snowplowOptions, { window.snowplowOptions = {
...window.snowplowOptions,
formTracking: true, formTracking: true,
linkClickTracking: true, linkClickTracking: true,
}); };
initUserTracking(); initUserTracking();
expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking');
......
...@@ -61,7 +61,7 @@ describe('Merge Request Collapsible Extension', () => { ...@@ -61,7 +61,7 @@ describe('Merge Request Collapsible Extension', () => {
describe('while loading', () => { describe('while loading', () => {
beforeEach(() => { beforeEach(() => {
mountComponent(Object.assign({}, data, { isLoading: true })); mountComponent({ ...data, isLoading: true });
}); });
it('renders the buttons disabled', () => { it('renders the buttons disabled', () => {
...@@ -86,7 +86,7 @@ describe('Merge Request Collapsible Extension', () => { ...@@ -86,7 +86,7 @@ describe('Merge Request Collapsible Extension', () => {
describe('with error', () => { describe('with error', () => {
beforeEach(() => { beforeEach(() => {
mountComponent(Object.assign({}, data, { hasError: true })); mountComponent({ ...data, hasError: true });
}); });
it('does not render the buttons', () => { it('does not render the buttons', () => {
......
...@@ -13,7 +13,7 @@ describe('MrWidgetPipelineContainer', () => { ...@@ -13,7 +13,7 @@ describe('MrWidgetPipelineContainer', () => {
const factory = (props = {}) => { const factory = (props = {}) => {
wrapper = mount(MrWidgetPipelineContainer, { wrapper = mount(MrWidgetPipelineContainer, {
propsData: { propsData: {
mr: Object.assign({}, mockStore), mr: { ...mockStore },
...props, ...props,
}, },
}); });
......
...@@ -91,9 +91,7 @@ describe('File row component', () => { ...@@ -91,9 +91,7 @@ describe('File row component', () => {
jest.spyOn(wrapper.vm, 'scrollIntoView'); jest.spyOn(wrapper.vm, 'scrollIntoView');
wrapper.setProps({ wrapper.setProps({
file: Object.assign({}, wrapper.props('file'), { file: { ...wrapper.props('file'), active: true },
active: true,
}),
}); });
return nextTick().then(() => { return nextTick().then(() => {
...@@ -125,9 +123,7 @@ describe('File row component', () => { ...@@ -125,9 +123,7 @@ describe('File row component', () => {
it('matches the current route against encoded file URL', () => { it('matches the current route against encoded file URL', () => {
const fileName = 'with space'; const fileName = 'with space';
const rowFile = Object.assign({}, file(fileName), { const rowFile = { ...file(fileName), url: `/${fileName}` };
url: `/${fileName}`,
});
const routerPath = `/project/${escapeFileUrl(fileName)}`; const routerPath = `/project/${escapeFileUrl(fileName)}`;
createComponent( createComponent(
{ {
......
...@@ -36,9 +36,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -36,9 +36,7 @@ describe('IssueMilestoneComponent', () => {
describe('isMilestoneStarted', () => { describe('isMilestoneStarted', () => {
it('should return `false` when milestoneStart prop is not defined', () => { it('should return `false` when milestoneStart prop is not defined', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, start_date: '' },
start_date: '',
}),
}); });
expect(wrapper.vm.isMilestoneStarted).toBe(false); expect(wrapper.vm.isMilestoneStarted).toBe(false);
...@@ -46,9 +44,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -46,9 +44,7 @@ describe('IssueMilestoneComponent', () => {
it('should return `true` when milestone start date is past current date', () => { it('should return `true` when milestone start date is past current date', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, start_date: '1990-07-22' },
start_date: '1990-07-22',
}),
}); });
expect(wrapper.vm.isMilestoneStarted).toBe(true); expect(wrapper.vm.isMilestoneStarted).toBe(true);
...@@ -58,9 +54,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -58,9 +54,7 @@ describe('IssueMilestoneComponent', () => {
describe('isMilestonePastDue', () => { describe('isMilestonePastDue', () => {
it('should return `false` when milestoneDue prop is not defined', () => { it('should return `false` when milestoneDue prop is not defined', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, due_date: '' },
due_date: '',
}),
}); });
expect(wrapper.vm.isMilestonePastDue).toBe(false); expect(wrapper.vm.isMilestonePastDue).toBe(false);
...@@ -68,9 +62,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -68,9 +62,7 @@ describe('IssueMilestoneComponent', () => {
it('should return `true` when milestone due is past current date', () => { it('should return `true` when milestone due is past current date', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, due_date: '1990-07-22' },
due_date: '1990-07-22',
}),
}); });
expect(wrapper.vm.isMilestonePastDue).toBe(true); expect(wrapper.vm.isMilestonePastDue).toBe(true);
...@@ -84,9 +76,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -84,9 +76,7 @@ describe('IssueMilestoneComponent', () => {
it('returns string containing absolute milestone start date when due date is not present', () => { it('returns string containing absolute milestone start date when due date is not present', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, due_date: '' },
due_date: '',
}),
}); });
expect(wrapper.vm.milestoneDatesAbsolute).toBe('(January 1, 2018)'); expect(wrapper.vm.milestoneDatesAbsolute).toBe('(January 1, 2018)');
...@@ -94,10 +84,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -94,10 +84,7 @@ describe('IssueMilestoneComponent', () => {
it('returns empty string when both milestone start and due dates are not present', () => { it('returns empty string when both milestone start and due dates are not present', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, start_date: '', due_date: '' },
start_date: '',
due_date: '',
}),
}); });
expect(wrapper.vm.milestoneDatesAbsolute).toBe(''); expect(wrapper.vm.milestoneDatesAbsolute).toBe('');
...@@ -107,9 +94,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -107,9 +94,7 @@ describe('IssueMilestoneComponent', () => {
describe('milestoneDatesHuman', () => { describe('milestoneDatesHuman', () => {
it('returns string containing milestone due date when date is yet to be due', () => { it('returns string containing milestone due date when date is yet to be due', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, due_date: `${new Date().getFullYear() + 10}-01-01` },
due_date: `${new Date().getFullYear() + 10}-01-01`,
}),
}); });
expect(wrapper.vm.milestoneDatesHuman).toContain('years remaining'); expect(wrapper.vm.milestoneDatesHuman).toContain('years remaining');
...@@ -117,10 +102,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -117,10 +102,7 @@ describe('IssueMilestoneComponent', () => {
it('returns string containing milestone start date when date has already started and due date is not present', () => { it('returns string containing milestone start date when date has already started and due date is not present', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, start_date: '1990-07-22', due_date: '' },
start_date: '1990-07-22',
due_date: '',
}),
}); });
expect(wrapper.vm.milestoneDatesHuman).toContain('Started'); expect(wrapper.vm.milestoneDatesHuman).toContain('Started');
...@@ -128,10 +110,11 @@ describe('IssueMilestoneComponent', () => { ...@@ -128,10 +110,11 @@ describe('IssueMilestoneComponent', () => {
it('returns string containing milestone start date when date is yet to start and due date is not present', () => { it('returns string containing milestone start date when date is yet to start and due date is not present', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: {
...mockMilestone,
start_date: `${new Date().getFullYear() + 10}-01-01`, start_date: `${new Date().getFullYear() + 10}-01-01`,
due_date: '', due_date: '',
}), },
}); });
expect(wrapper.vm.milestoneDatesHuman).toContain('Starts'); expect(wrapper.vm.milestoneDatesHuman).toContain('Starts');
...@@ -139,10 +122,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -139,10 +122,7 @@ describe('IssueMilestoneComponent', () => {
it('returns empty string when milestone start and due dates are not present', () => { it('returns empty string when milestone start and due dates are not present', () => {
wrapper.setProps({ wrapper.setProps({
milestone: Object.assign({}, mockMilestone, { milestone: { ...mockMilestone, start_date: '', due_date: '' },
start_date: '',
due_date: '',
}),
}); });
expect(wrapper.vm.milestoneDatesHuman).toBe(''); expect(wrapper.vm.milestoneDatesHuman).toBe('');
......
...@@ -8,11 +8,12 @@ import { ...@@ -8,11 +8,12 @@ import {
mockLabels, mockLabels,
} from '../../../../../javascripts/vue_shared/components/sidebar/labels_select/mock_data'; } from '../../../../../javascripts/vue_shared/components/sidebar/labels_select/mock_data';
const componentConfig = Object.assign({}, mockConfig, { const componentConfig = {
...mockConfig,
fieldName: 'label_id[]', fieldName: 'label_id[]',
labels: mockLabels, labels: mockLabels,
showExtraOptions: false, showExtraOptions: false,
}); };
const createComponent = (config = componentConfig) => { const createComponent = (config = componentConfig) => {
const Component = Vue.extend(dropdownButtonComponent); const Component = Vue.extend(dropdownButtonComponent);
...@@ -34,7 +35,7 @@ describe('DropdownButtonComponent', () => { ...@@ -34,7 +35,7 @@ describe('DropdownButtonComponent', () => {
describe('computed', () => { describe('computed', () => {
describe('dropdownToggleText', () => { describe('dropdownToggleText', () => {
it('returns text as `Label` when `labels` prop is empty array', () => { it('returns text as `Label` when `labels` prop is empty array', () => {
const mockEmptyLabels = Object.assign({}, componentConfig, { labels: [] }); const mockEmptyLabels = { ...componentConfig, labels: [] };
const vmEmptyLabels = createComponent(mockEmptyLabels); const vmEmptyLabels = createComponent(mockEmptyLabels);
expect(vmEmptyLabels.dropdownToggleText).toBe('Label'); expect(vmEmptyLabels.dropdownToggleText).toBe('Label');
...@@ -42,9 +43,7 @@ describe('DropdownButtonComponent', () => { ...@@ -42,9 +43,7 @@ describe('DropdownButtonComponent', () => {
}); });
it('returns first label name with remaining label count when `labels` prop has more than one item', () => { it('returns first label name with remaining label count when `labels` prop has more than one item', () => {
const mockMoreLabels = Object.assign({}, componentConfig, { const mockMoreLabels = { ...componentConfig, labels: mockLabels.concat(mockLabels) };
labels: mockLabels.concat(mockLabels),
});
const vmMoreLabels = createComponent(mockMoreLabels); const vmMoreLabels = createComponent(mockMoreLabels);
expect(vmMoreLabels.dropdownToggleText).toBe( expect(vmMoreLabels.dropdownToggleText).toBe(
...@@ -54,9 +53,7 @@ describe('DropdownButtonComponent', () => { ...@@ -54,9 +53,7 @@ describe('DropdownButtonComponent', () => {
}); });
it('returns first label name when `labels` prop has only one item present', () => { it('returns first label name when `labels` prop has only one item present', () => {
const singleLabel = Object.assign({}, componentConfig, { const singleLabel = { ...componentConfig, labels: [mockLabels[0]] };
labels: [mockLabels[0]],
});
const vmSingleLabel = createComponent(singleLabel); const vmSingleLabel = createComponent(singleLabel);
expect(vmSingleLabel.dropdownToggleText).toBe(mockLabels[0].title); expect(vmSingleLabel.dropdownToggleText).toBe(mockLabels[0].title);
......
...@@ -15,7 +15,7 @@ describe('LabelsSelect Actions', () => { ...@@ -15,7 +15,7 @@ describe('LabelsSelect Actions', () => {
}; };
beforeEach(() => { beforeEach(() => {
state = Object.assign({}, defaultState()); state = { ...defaultState() };
}); });
describe('setInitialState', () => { describe('setInitialState', () => {
......
...@@ -69,7 +69,7 @@ const defaults = { ...@@ -69,7 +69,7 @@ const defaults = {
}; };
function testGlEmojiElement(element, name, unicodeVersion, unicodeMoji, options = {}) { function testGlEmojiElement(element, name, unicodeVersion, unicodeMoji, options = {}) {
const opts = Object.assign({}, defaults, options); const opts = { ...defaults, ...options };
expect(element.tagName.toLowerCase()).toBe('gl-emoji'); expect(element.tagName.toLowerCase()).toBe('gl-emoji');
expect(element.dataset.name).toBe(name); expect(element.dataset.name).toBe(name);
expect(element.dataset.fallbackSrc.length).toBeGreaterThan(0); expect(element.dataset.fallbackSrc.length).toBeGreaterThan(0);
...@@ -383,9 +383,7 @@ describe('gl_emoji', () => { ...@@ -383,9 +383,7 @@ describe('gl_emoji', () => {
it('bomb(6.0) with 6.0 support', () => { it('bomb(6.0) with 6.0 support', () => {
const emojiKey = 'bomb'; const emojiKey = 'bomb';
const unicodeSupportMap = Object.assign({}, emptySupportMap, { const unicodeSupportMap = { ...emptySupportMap, '6.0': true };
'6.0': true,
});
const isSupported = isEmojiUnicodeSupported( const isSupported = isEmojiUnicodeSupported(
unicodeSupportMap, unicodeSupportMap,
emojiFixtureMap[emojiKey].moji, emojiFixtureMap[emojiKey].moji,
...@@ -409,9 +407,7 @@ describe('gl_emoji', () => { ...@@ -409,9 +407,7 @@ describe('gl_emoji', () => {
it('bomb(6.0) without 6.0 but with 9.0 support', () => { it('bomb(6.0) without 6.0 but with 9.0 support', () => {
const emojiKey = 'bomb'; const emojiKey = 'bomb';
const unicodeSupportMap = Object.assign({}, emptySupportMap, { const unicodeSupportMap = { ...emptySupportMap, '9.0': true };
'9.0': true,
});
const isSupported = isEmojiUnicodeSupported( const isSupported = isEmojiUnicodeSupported(
unicodeSupportMap, unicodeSupportMap,
emojiFixtureMap[emojiKey].moji, emojiFixtureMap[emojiKey].moji,
...@@ -423,7 +419,8 @@ describe('gl_emoji', () => { ...@@ -423,7 +419,8 @@ describe('gl_emoji', () => {
it('construction_worker_tone5(8.0) without skin tone modifier support', () => { it('construction_worker_tone5(8.0) without skin tone modifier support', () => {
const emojiKey = 'construction_worker_tone5'; const emojiKey = 'construction_worker_tone5';
const unicodeSupportMap = Object.assign({}, emptySupportMap, { const unicodeSupportMap = {
...emptySupportMap,
skinToneModifier: false, skinToneModifier: false,
'9.0': true, '9.0': true,
'8.0': true, '8.0': true,
...@@ -437,7 +434,7 @@ describe('gl_emoji', () => { ...@@ -437,7 +434,7 @@ describe('gl_emoji', () => {
3.2: true, 3.2: true,
'3.0': true, '3.0': true,
1.1: true, 1.1: true,
}); };
const isSupported = isEmojiUnicodeSupported( const isSupported = isEmojiUnicodeSupported(
unicodeSupportMap, unicodeSupportMap,
emojiFixtureMap[emojiKey].moji, emojiFixtureMap[emojiKey].moji,
...@@ -449,13 +446,14 @@ describe('gl_emoji', () => { ...@@ -449,13 +446,14 @@ describe('gl_emoji', () => {
it('use native keycap on >=57 chrome', () => { it('use native keycap on >=57 chrome', () => {
const emojiKey = 'five'; const emojiKey = 'five';
const unicodeSupportMap = Object.assign({}, emptySupportMap, { const unicodeSupportMap = {
...emptySupportMap,
'3.0': true, '3.0': true,
meta: { meta: {
isChrome: true, isChrome: true,
chromeVersion: 57, chromeVersion: 57,
}, },
}); };
const isSupported = isEmojiUnicodeSupported( const isSupported = isEmojiUnicodeSupported(
unicodeSupportMap, unicodeSupportMap,
emojiFixtureMap[emojiKey].moji, emojiFixtureMap[emojiKey].moji,
...@@ -467,13 +465,14 @@ describe('gl_emoji', () => { ...@@ -467,13 +465,14 @@ describe('gl_emoji', () => {
it('fallback keycap on <57 chrome', () => { it('fallback keycap on <57 chrome', () => {
const emojiKey = 'five'; const emojiKey = 'five';
const unicodeSupportMap = Object.assign({}, emptySupportMap, { const unicodeSupportMap = {
...emptySupportMap,
'3.0': true, '3.0': true,
meta: { meta: {
isChrome: true, isChrome: true,
chromeVersion: 50, chromeVersion: 50,
}, },
}); };
const isSupported = isEmojiUnicodeSupported( const isSupported = isEmojiUnicodeSupported(
unicodeSupportMap, unicodeSupportMap,
emojiFixtureMap[emojiKey].moji, emojiFixtureMap[emojiKey].moji,
......
...@@ -44,19 +44,17 @@ describe('glDropdown', function describeDropdown() { ...@@ -44,19 +44,17 @@ describe('glDropdown', function describeDropdown() {
}; };
function initDropDown(hasRemote, isFilterable, extraOpts = {}) { function initDropDown(hasRemote, isFilterable, extraOpts = {}) {
const options = Object.assign( const options = {
{ selectable: true,
selectable: true, filterable: isFilterable,
filterable: isFilterable, data: hasRemote ? remoteMock.bind({}, this.projectsData) : this.projectsData,
data: hasRemote ? remoteMock.bind({}, this.projectsData) : this.projectsData, search: {
search: { fields: ['name'],
fields: ['name'],
},
text: project => project.name_with_namespace || project.name,
id: project => project.id,
}, },
extraOpts, text: project => project.name_with_namespace || project.name,
); id: project => project.id,
...extraOpts,
};
this.dropdownButtonElement = $( this.dropdownButtonElement = $(
'#js-project-dropdown', '#js-project-dropdown',
this.dropdownContainerElement, this.dropdownContainerElement,
......
...@@ -10,11 +10,7 @@ describe('ImageBadge', () => { ...@@ -10,11 +10,7 @@ describe('ImageBadge', () => {
}; };
it('should save actual property', () => { it('should save actual property', () => {
const imageBadge = new ImageBadge( const imageBadge = new ImageBadge({ ...options, actual: imageMeta });
Object.assign({}, options, {
actual: imageMeta,
}),
);
const { actual } = imageBadge; const { actual } = imageBadge;
...@@ -25,11 +21,7 @@ describe('ImageBadge', () => { ...@@ -25,11 +21,7 @@ describe('ImageBadge', () => {
}); });
it('should save browser property', () => { it('should save browser property', () => {
const imageBadge = new ImageBadge( const imageBadge = new ImageBadge({ ...options, browser: imageMeta });
Object.assign({}, options, {
browser: imageMeta,
}),
);
const { browser } = imageBadge; const { browser } = imageBadge;
...@@ -83,11 +75,7 @@ describe('ImageBadge', () => { ...@@ -83,11 +75,7 @@ describe('ImageBadge', () => {
}); });
it('should generate browser property', () => { it('should generate browser property', () => {
const imageBadge = new ImageBadge( const imageBadge = new ImageBadge({ ...options, imageEl: document.createElement('img') });
Object.assign({}, options, {
imageEl: document.createElement('img'),
}),
);
expect(imageDiffHelper.resizeCoordinatesToImageElement).toHaveBeenCalled(); expect(imageDiffHelper.resizeCoordinatesToImageElement).toHaveBeenCalled();
expect(imageBadge.browser).toEqual(true); expect(imageBadge.browser).toEqual(true);
......
...@@ -66,7 +66,7 @@ describe('Commit block', () => { ...@@ -66,7 +66,7 @@ describe('Commit block', () => {
describe('without merge request', () => { describe('without merge request', () => {
it('does not render merge request', () => { it('does not render merge request', () => {
const copyProps = Object.assign({}, props); const copyProps = { ...props };
delete copyProps.mergeRequest; delete copyProps.mergeRequest;
vm = mountComponent(Component, { vm = mountComponent(Component, {
......
...@@ -20,7 +20,7 @@ describe('Sidebar details block', () => { ...@@ -20,7 +20,7 @@ describe('Sidebar details block', () => {
describe('when there is no retry path retry', () => { describe('when there is no retry path retry', () => {
it('should not render a retry button', () => { it('should not render a retry button', () => {
const copy = Object.assign({}, job); const copy = { ...job };
delete copy.retry_path; delete copy.retry_path;
store.dispatch('receiveJobSuccess', copy); store.dispatch('receiveJobSuccess', copy);
...@@ -43,10 +43,7 @@ describe('Sidebar details block', () => { ...@@ -43,10 +43,7 @@ describe('Sidebar details block', () => {
describe('with terminal path', () => { describe('with terminal path', () => {
it('renders terminal link', () => { it('renders terminal link', () => {
store.dispatch( store.dispatch('receiveJobSuccess', { ...job, terminal_path: 'job/43123/terminal' });
'receiveJobSuccess',
Object.assign({}, job, { terminal_path: 'job/43123/terminal' }),
);
vm = mountComponentWithStore(SidebarComponent, { vm = mountComponentWithStore(SidebarComponent, {
store, store,
}); });
......
...@@ -40,7 +40,7 @@ describe('Test Issue body', () => { ...@@ -40,7 +40,7 @@ describe('Test Issue body', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponentWithStore(Component, { vm = mountComponentWithStore(Component, {
store, store,
props: Object.assign({}, commonProps, { isNew: true }), props: { ...commonProps, isNew: true },
}); });
}); });
......
...@@ -153,7 +153,7 @@ describe('MRWidgetHeader', () => { ...@@ -153,7 +153,7 @@ describe('MRWidgetHeader', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
mr: Object.assign({}, mrDefaultOptions), mr: { ...mrDefaultOptions },
}); });
}); });
...@@ -176,7 +176,7 @@ describe('MRWidgetHeader', () => { ...@@ -176,7 +176,7 @@ describe('MRWidgetHeader', () => {
}); });
it('renders web ide button in disabled state with no href', () => { it('renders web ide button in disabled state with no href', () => {
const mr = Object.assign({}, mrDefaultOptions, { canPushToSourceBranch: false }); const mr = { ...mrDefaultOptions, canPushToSourceBranch: false };
vm = mountComponent(Component, { mr }); vm = mountComponent(Component, { mr });
const link = vm.$el.querySelector('.js-web-ide'); const link = vm.$el.querySelector('.js-web-ide');
......
...@@ -30,11 +30,7 @@ describe('DiffViewer', () => { ...@@ -30,11 +30,7 @@ describe('DiffViewer', () => {
relative_url_root: '', relative_url_root: '',
}; };
createComponent( createComponent({ ...requiredProps, projectPath: '' });
Object.assign({}, requiredProps, {
projectPath: '',
}),
);
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.deleted img').getAttribute('src')).toBe( expect(vm.$el.querySelector('.deleted img').getAttribute('src')).toBe(
...@@ -50,13 +46,12 @@ describe('DiffViewer', () => { ...@@ -50,13 +46,12 @@ describe('DiffViewer', () => {
}); });
it('renders fallback download diff display', done => { it('renders fallback download diff display', done => {
createComponent( createComponent({
Object.assign({}, requiredProps, { ...requiredProps,
diffViewerMode: 'added', diffViewerMode: 'added',
newPath: 'test.abc', newPath: 'test.abc',
oldPath: 'testold.abc', oldPath: 'testold.abc',
}), });
);
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.deleted .file-info').textContent.trim()).toContain( expect(vm.$el.querySelector('.deleted .file-info').textContent.trim()).toContain(
...@@ -77,28 +72,26 @@ describe('DiffViewer', () => { ...@@ -77,28 +72,26 @@ describe('DiffViewer', () => {
}); });
it('renders renamed component', () => { it('renders renamed component', () => {
createComponent( createComponent({
Object.assign({}, requiredProps, { ...requiredProps,
diffMode: 'renamed', diffMode: 'renamed',
diffViewerMode: 'renamed', diffViewerMode: 'renamed',
newPath: 'test.abc', newPath: 'test.abc',
oldPath: 'testold.abc', oldPath: 'testold.abc',
}), });
);
expect(vm.$el.textContent).toContain('File moved'); expect(vm.$el.textContent).toContain('File moved');
}); });
it('renders mode changed component', () => { it('renders mode changed component', () => {
createComponent( createComponent({
Object.assign({}, requiredProps, { ...requiredProps,
diffMode: 'mode_changed', diffMode: 'mode_changed',
newPath: 'test.abc', newPath: 'test.abc',
oldPath: 'testold.abc', oldPath: 'testold.abc',
aMode: '123', aMode: '123',
bMode: '321', bMode: '321',
}), });
);
expect(vm.$el.textContent).toContain('File mode changed from 123 to 321'); expect(vm.$el.textContent).toContain('File mode changed from 123 to 321');
}); });
......
...@@ -25,12 +25,7 @@ describe('toolbar', () => { ...@@ -25,12 +25,7 @@ describe('toolbar', () => {
describe('user cannot attach file', () => { describe('user cannot attach file', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent( vm = mountComponent(Toolbar, { ...props, canAttachFile: false });
Toolbar,
Object.assign({}, props, {
canAttachFile: false,
}),
);
}); });
it('should not render uploading-container', () => { it('should not render uploading-container', () => {
......
...@@ -5,18 +5,15 @@ import stackedProgressBarComponent from '~/vue_shared/components/stacked_progres ...@@ -5,18 +5,15 @@ import stackedProgressBarComponent from '~/vue_shared/components/stacked_progres
const createComponent = config => { const createComponent = config => {
const Component = Vue.extend(stackedProgressBarComponent); const Component = Vue.extend(stackedProgressBarComponent);
const defaultConfig = Object.assign( const defaultConfig = {
{}, successLabel: 'Synced',
{ failureLabel: 'Failed',
successLabel: 'Synced', neutralLabel: 'Out of sync',
failureLabel: 'Failed', successCount: 25,
neutralLabel: 'Out of sync', failureCount: 10,
successCount: 25, totalCount: 5000,
failureCount: 10, ...config,
totalCount: 5000, };
},
config,
);
return mountComponent(Component, defaultConfig); return mountComponent(Component, defaultConfig);
}; };
......
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