@@ -154,7 +149,6 @@ const Header: React.VoidFunctionComponent
= ({ i18n }) => {
dispatch(explorerArchiveAllFiles())}
/>
{
);
});
+ it('should fail if there are no files in storage', async () => {
+ saga.put(fileStorageDidDumpAllFiles([]));
+
+ await expect(saga.take()).resolves.toEqual(
+ explorerDidFailToArchiveAllFiles(new Error('no files')),
+ );
+ });
+
describe('should continue when fileStorage succeeds', () => {
beforeEach(async () => {
saga.put(
diff --git a/src/explorer/sagas.ts b/src/explorer/sagas.ts
index bb571ff7..8c7eb42f 100644
--- a/src/explorer/sagas.ts
+++ b/src/explorer/sagas.ts
@@ -93,6 +93,10 @@ function* handleExplorerArchiveAllFiles(): Generator {
defined(didDump);
+ if (didDump.files.length === 0) {
+ throw new Error('no files');
+ }
+
const zip = new JSZip();
for (const f of didDump.files) {