it('should throw error when removing file and url is invalid', async () => { nock(API).delete('/in/test/-1').reply(500) await store.dispatch(fileActions.remove(-1)) expect(store.getActions()).toEqual([ {type: constants.REMOVE_FILE_START}, {type: constants.REMOVE_FILE_FAILED}, ]) })
it('should remove file and fetch files', async () => { nock(API).get(filesURI()).reply(200, { items: [{_id: -1}] }) nock(API).delete(`/in/${initialStore.files.project}/-1`).reply(200, { items: [{_id: -1}] }) await store.dispatch(fileActions.remove(-1)) expect(store.getActions()).toEqual([ {type: constants.REMOVE_FILE_START}, {type: constants.REMOVE_FILE_COMPLETE}, {type: constants.FETCH_FILES_START}, ]) })