diff options
Diffstat (limited to 'spec/frontend/design_management_legacy/utils/cache_update_spec.js')
-rw-r--r-- | spec/frontend/design_management_legacy/utils/cache_update_spec.js | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/spec/frontend/design_management_legacy/utils/cache_update_spec.js b/spec/frontend/design_management_legacy/utils/cache_update_spec.js deleted file mode 100644 index dce91b5e59b..00000000000 --- a/spec/frontend/design_management_legacy/utils/cache_update_spec.js +++ /dev/null @@ -1,44 +0,0 @@ -import { InMemoryCache } from 'apollo-cache-inmemory'; -import { - updateStoreAfterDesignsDelete, - updateStoreAfterAddDiscussionComment, - updateStoreAfterAddImageDiffNote, - updateStoreAfterUploadDesign, - updateStoreAfterUpdateImageDiffNote, -} from '~/design_management_legacy/utils/cache_update'; -import { - designDeletionError, - ADD_DISCUSSION_COMMENT_ERROR, - ADD_IMAGE_DIFF_NOTE_ERROR, - UPDATE_IMAGE_DIFF_NOTE_ERROR, -} from '~/design_management_legacy/utils/error_messages'; -import design from '../mock_data/design'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; - -jest.mock('~/flash.js'); - -describe('Design Management cache update', () => { - const mockErrors = ['code red!']; - - let mockStore; - - beforeEach(() => { - mockStore = new InMemoryCache(); - }); - - describe('error handling', () => { - it.each` - fnName | subject | errorMessage | extraArgs - ${'updateStoreAfterDesignsDelete'} | ${updateStoreAfterDesignsDelete} | ${designDeletionError({ singular: true })} | ${[[design]]} - ${'updateStoreAfterAddDiscussionComment'} | ${updateStoreAfterAddDiscussionComment} | ${ADD_DISCUSSION_COMMENT_ERROR} | ${[]} - ${'updateStoreAfterAddImageDiffNote'} | ${updateStoreAfterAddImageDiffNote} | ${ADD_IMAGE_DIFF_NOTE_ERROR} | ${[]} - ${'updateStoreAfterUploadDesign'} | ${updateStoreAfterUploadDesign} | ${mockErrors[0]} | ${[]} - ${'updateStoreAfterUpdateImageDiffNote'} | ${updateStoreAfterUpdateImageDiffNote} | ${UPDATE_IMAGE_DIFF_NOTE_ERROR} | ${[]} - `('$fnName handles errors in response', ({ subject, extraArgs, errorMessage }) => { - expect(createFlash).not.toHaveBeenCalled(); - expect(() => subject(mockStore, { errors: mockErrors }, {}, ...extraArgs)).toThrow(); - expect(createFlash).toHaveBeenCalledTimes(1); - expect(createFlash).toHaveBeenCalledWith(errorMessage); - }); - }); -}); |