Commit e0b8384e authored by Tom Quirk's avatar Tom Quirk

Make trackUploadDesign more robust

Fall back to empty array for designs
in response.
parent 70cbe985
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
this.trackUploadDesign(res); this.trackUploadDesign(res);
}, },
trackUploadDesign(res) { trackUploadDesign(res) {
res.data.designManagementUpload.designs.forEach(design => { (res?.data?.designManagementUpload?.designs || []).forEach(design => {
if (design.event === 'CREATION') { if (design.event === 'CREATION') {
trackDesignCreate(); trackDesignCreate();
} else if (design.event === 'MODIFICATION') { } else if (design.event === 'MODIFICATION') {
......
...@@ -374,7 +374,7 @@ describe('Design management index page', () => { ...@@ -374,7 +374,7 @@ describe('Design management index page', () => {
createComponent({ stubs: { GlEmptyState } }); createComponent({ stubs: { GlEmptyState } });
wrapper.setData({ filesToBeSaved: [{ name: 'test' }] }); wrapper.setData({ filesToBeSaved: [{ name: 'test' }] });
wrapper.vm.onUploadDesignDone(); wrapper.vm.onUploadDesignDone(designUploadMutationCreatedResponse);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.filesToBeSaved).toEqual([]); expect(wrapper.vm.filesToBeSaved).toEqual([]);
expect(wrapper.vm.isSaving).toBeFalsy(); expect(wrapper.vm.isSaving).toBeFalsy();
......
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