joplin-plugin-backup 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -298,6 +298,51 @@ describe("Backup", function () {
298
298
  expect(fs.existsSync(expected)).toBe(true);
299
299
  });
300
300
 
301
+ it(`retention = 1, folder exist with same files and folder`, async () => {
302
+ const emptyFolder = path.join(testPath.activeBackupJob, "emptyFolder");
303
+ const emptyFolderCheck = path.join(
304
+ testPath.backupBasePath,
305
+ "emptyFolder"
306
+ );
307
+ const folderNotes = path.join(testPath.activeBackupJob, "notes");
308
+ const folderNotesCheck = path.join(testPath.backupBasePath, "notes");
309
+ const file1 = path.join(folderNotes, "file.txt");
310
+ const file1Check = path.join(folderNotesCheck, "file.txt");
311
+ const file2 = path.join(testPath.activeBackupJob, "file.txt");
312
+ const file2Check = path.join(testPath.backupBasePath, "file.txt");
313
+ const file3Check = path.join(testPath.backupBasePath, "fileStay.txt");
314
+ const file4Check = path.join(folderNotesCheck, "fileNo.txt");
315
+ backup.backupBasePath = testPath.backupBasePath;
316
+ backup.activeBackupPath = testPath.activeBackupJob;
317
+
318
+ fs.emptyDirSync(testPath.backupBasePath);
319
+ fs.emptyDirSync(emptyFolderCheck);
320
+ fs.emptyDirSync(folderNotesCheck);
321
+ fs.writeFileSync(file1Check, "old file");
322
+ fs.writeFileSync(file2Check, "old file");
323
+ fs.writeFileSync(file3Check, "old file");
324
+ fs.writeFileSync(file4Check, "old file");
325
+
326
+ fs.emptyDirSync(testPath.activeBackupJob);
327
+ fs.emptyDirSync(emptyFolder);
328
+ fs.emptyDirSync(folderNotes);
329
+ fs.writeFileSync(file1, "new file");
330
+ fs.writeFileSync(file2, "new file");
331
+
332
+ backup.backupRetention = 1;
333
+
334
+ expect(await backup.moveFinishedBackup()).toBe(testPath.backupBasePath);
335
+ expect(fs.existsSync(folderNotes)).toBe(false);
336
+ expect(fs.existsSync(folderNotesCheck)).toBe(true);
337
+ expect(fs.existsSync(emptyFolderCheck)).toBe(true);
338
+ expect(fs.existsSync(file1Check)).toBe(true);
339
+ expect(fs.existsSync(file2Check)).toBe(true);
340
+ expect(fs.existsSync(file3Check)).toBe(true);
341
+ expect(fs.existsSync(file4Check)).toBe(false);
342
+ expect(backup.log.error).toHaveBeenCalledTimes(0);
343
+ expect(backup.log.warn).toHaveBeenCalledTimes(0);
344
+ });
345
+
301
346
  it(`retention > 1, file exist`, async () => {
302
347
  backup.backupBasePath = testPath.backupBasePath;
303
348
  backup.activeBackupPath = testPath.activeBackupJob;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joplin-plugin-backup",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "scripts": {
5
5
  "dist": "webpack --joplin-plugin-config buildMain && webpack --joplin-plugin-config buildExtraScripts && webpack --joplin-plugin-config createArchive",
6
6
  "prepare": "npm run dist && husky install",
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 1,
3
3
  "id": "io.github.jackgruber.backup",
4
4
  "app_min_version": "2.1.3",
5
- "version": "1.2.0",
5
+ "version": "1.2.1",
6
6
  "name": "Simple Backup",
7
7
  "description": "Plugin to create manual and automatic backups.",
8
8
  "author": "JackGruber",
@@ -16,6 +16,6 @@
16
16
  "7zip",
17
17
  "encrypted"
18
18
  ],
19
- "_publish_hash": "sha256:5b9605100911c96c157853884f1fb8fc0e4374697f493dcbeb45fd09068e469d",
20
- "_publish_commit": "master:1a5f98eef052081f501e9bcda2fd1f69f2dbeb04"
19
+ "_publish_hash": "sha256:ee3fee3a90fe21a1c656240f9e3506fd6651a7318f398a484c6c31bef425dec8",
20
+ "_publish_commit": "master:e4e8e6cff708bc7f181d2c18122084b7aeb4fb32"
21
21
  }