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 {
this.trackUploadDesign(res);
},
trackUploadDesign(res) {
res.data.designManagementUpload.designs.forEach(design => {
(res?.data?.designManagementUpload?.designs || []).forEach(design => {
if (design.event === 'CREATION') {
trackDesignCreate();
} else if (design.event === 'MODIFICATION') {
......
......@@ -374,7 +374,7 @@ describe('Design management index page', () => {
createComponent({ stubs: { GlEmptyState } });
wrapper.setData({ filesToBeSaved: [{ name: 'test' }] });
wrapper.vm.onUploadDesignDone();
wrapper.vm.onUploadDesignDone(designUploadMutationCreatedResponse);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.filesToBeSaved).toEqual([]);
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