remotely-save/tests/misc.test.ts

418 lines
12 KiB
TypeScript
Raw Permalink Normal View History

2024-04-26 19:28:39 +00:00
import { strict as assert } from "assert";
2021-12-11 14:45:21 +00:00
import { JSDOM } from "jsdom";
2021-11-07 05:58:51 +00:00
import * as misc from "../src/misc";
2021-11-07 04:14:14 +00:00
2021-11-07 05:13:40 +00:00
describe("Misc: hidden file", () => {
2021-11-07 04:14:14 +00:00
it("should find hidden file correctly", () => {
2021-11-07 05:58:51 +00:00
let item = "";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = ".";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "..";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "/x/y/z/../././../a/b/c";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = ".hidden";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "_hidden_loose";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item));
assert.ok(!misc.isHiddenPath(item, true, false));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "/sdd/_hidden_loose";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "what/../_hidden_loose/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "what/../_hidden_loose/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item, true, false));
2021-11-07 04:14:14 +00:00
2021-11-07 05:58:51 +00:00
item = "what/../_hidden_loose/../.hidden/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item, true, false));
item = "what/../_hidden_loose/../.hidden/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item, false, true));
item = "what/_hidden_loose/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(misc.isHiddenPath(item, false, true));
assert.ok(!misc.isHiddenPath(item, true, false));
item = "what/.hidden/what/what/what";
2024-04-26 19:28:39 +00:00
assert.ok(!misc.isHiddenPath(item, false, true));
assert.ok(misc.isHiddenPath(item, true, false));
2021-11-07 04:14:14 +00:00
});
});
2021-11-07 05:58:51 +00:00
describe("Misc: get folder levels", () => {
it("should ignore empty path", () => {
const item = "";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getFolderLevels(item).length, 0);
2021-11-07 05:58:51 +00:00
});
it("should ignore single file", () => {
const item = "xxx";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getFolderLevels(item).length, 0);
2021-11-07 05:58:51 +00:00
});
it("should detect path ending with /", () => {
const item = "xxx/";
const res = ["xxx"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item), res);
2021-11-07 05:58:51 +00:00
});
it("should correctly split folders and files", () => {
const item = "xxx/yyy/zzz.md";
const res = ["xxx", "xxx/yyy"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item), res);
2021-11-07 05:58:51 +00:00
const item2 = "xxx/yyy/zzz";
const res2 = ["xxx", "xxx/yyy"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item2), res2);
2021-11-07 05:58:51 +00:00
const item3 = "xxx/yyy/zzz/";
const res3 = ["xxx", "xxx/yyy", "xxx/yyy/zzz"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item3), res3);
2021-11-07 05:58:51 +00:00
});
2021-11-28 02:45:46 +00:00
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
it("should correctly add ending slash if required", () => {
const item = "xxx/yyy/zzz.md";
const res = ["xxx/", "xxx/yyy/"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item, true), res);
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
const item2 = "xxx/yyy/zzz";
const res2 = ["xxx/", "xxx/yyy/"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item2, true), res2);
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
const item3 = "xxx/yyy/zzz/";
const res3 = ["xxx/", "xxx/yyy/", "xxx/yyy/zzz/"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item3, true), res3);
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
});
2021-11-28 04:18:44 +00:00
it("should treat path starting with / correctly", () => {
2021-11-28 02:45:46 +00:00
const item = "/xxx/yyy/zzz.md";
const res = ["/xxx", "/xxx/yyy"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item), res);
2021-11-28 02:45:46 +00:00
const item2 = "/xxx/yyy/zzz";
const res2 = ["/xxx", "/xxx/yyy"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item2), res2);
2021-11-28 02:45:46 +00:00
const item3 = "/xxx/yyy/zzz/";
const res3 = ["/xxx", "/xxx/yyy", "/xxx/yyy/zzz"];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item3), res3);
2021-11-28 02:45:46 +00:00
const item4 = "/xxx";
const res4 = [] as string[];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item4), res4);
2021-11-28 02:45:46 +00:00
const item5 = "/";
const res5 = [] as string[];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.getFolderLevels(item5), res5);
2021-11-28 02:45:46 +00:00
});
2021-11-07 05:58:51 +00:00
});
2021-11-09 02:00:44 +00:00
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
describe("Misc: get parent folder", () => {
it("should treat empty path correctly", () => {
const item = "";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getParentFolder(item), "/");
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
});
it("should treat one level path correctly", () => {
let item = "abc/";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getParentFolder(item), "/");
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
item = "/efg/";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getParentFolder(item), "/");
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
});
it("should treat more levels path correctly", () => {
let item = "abc/efg";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getParentFolder(item), "abc/");
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
item = "/hij/klm/";
2024-04-26 19:28:39 +00:00
assert.equal(misc.getParentFolder(item), "/hij/");
new sync algo, squashed commit of the following: commit 692bb794aea5609b9e9abf5228620f4479e50983 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:52:43 2022 +0800 bump to 0.3.0 commit 77335412ad2da2b5bd1ed5075061a5af006e3c36 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:50:57 2022 +0800 change titles for minimal intrusive design commit 2812adebb84344d384749a62acb63fd0c6fd509d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:53 2022 +0800 remove syncv1 commit 22fc24a76c9851740bbc7c0177d1cb2526e15d8b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 27 17:30:27 2022 +0800 full notice to any one commit d56ea24a78f6dc1fbea2740011ee1cea9c403d4c Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 23:11:14 2022 +0800 fix test commit 759f82593bbfb9b49079cfd80dbadbbafc0287e5 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:59:25 2022 +0800 obfuscate metadata on remote commit 9b6bf05288af0e52d0f02468e5ac8757f4f896df Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 21:33:52 2022 +0800 avoid re-uploading if meta not changed commit 03be1453764e48e99207f44467ee4d5801072ed8 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:35:52 2022 +0800 add password condition commit 7f899f7c2572df3e2a35e16cbdaab94db113f366 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 26 00:22:58 2022 +0800 add decision branch for easier debugging commit cf4071bf3156356ae6ec3a9cb187c2cb541d1b17 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:40:52 2022 +0800 change folder error commit 964493dd998699a1d53018a201637bda192c4baa Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 23:09:44 2022 +0800 finnaly remote remove should be working commit 2888e65452f9c0e1dde6005f012c3ee0a6313c3f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:18:15 2022 +0800 optimize comparation commit 024936951d6180b1296c2a5d56c5bf5d468e9ae7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Fri Feb 25 01:14:44 2022 +0800 allow uploading extra meta commit 007006701d536da2b4b46389941980579bbc4e67 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 01:08:58 2022 +0800 add logic to fetch extra meta commit c9d3a05ca1bf45c06f22233124670e5e45b5f5f1 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:29:16 2022 +0800 another way to deal with trash commit 82d455f8bf60f7bac8eb4e299a2ca44c331a6d7f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Feb 24 00:28:51 2022 +0800 add return buffer for downloading commit b8e6b79bc078def2854bc73578b7f520cc39ab34 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Feb 23 00:16:06 2022 +0800 half way to actual sync commit 90cceb1411b46af9741f2caa3ab8beafaf69c1b2 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 23:36:09 2022 +0800 cleaner way to remember the folder being kept commit c1afb763cc4e0f7905c83e0a8eb20f8ed969a279 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Feb 22 00:03:21 2022 +0800 simplified way to get plans for sync algo v2 commit 5c5ecce39eb3854900f1f5b79c7beb189e78a6a7 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:58 2022 +0800 archive the old sync algo v1 doc commit 75cdfa1ee9834600f83ded6672b102de2c5f9616 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 23:13:14 2022 +0800 simplify sync algo v2 commit dc9275835d961de07efcbaa81657e4745242e72a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 22:58:57 2022 +0800 add way to skip recording removing commit f9712ef96021dfed4ae33e6c649f78e940b7e530 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 09:38:09 2022 +0800 fix sync commit 9007dcf22ef317dde36ac4f1dd589d05cc8d5cf6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:54:21 2022 +0800 fix assignment commit 77abee6ad443b62353ed3913e0945ea7d1314f87 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:28:43 2022 +0800 draft of sync v2 commit a0c26238bf60692e095cfd8527abf937255b56d4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 21 00:23:19 2022 +0800 how to deal with folders commit c10f92a7e8d3c4a4f4c585e39e0abad1a5376c02 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:39:16 2022 +0800 helper func to get parents commit f903c98b3b7b9d1e785d04b9fc0cfcafdc6e5661 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 23:31:21 2022 +0800 add optional ending slash to getFolderLevels commit 2d67c9b2b941e676588fa43ab289fab79f567e5e Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:44:44 2022 +0800 update sync algo v2 commit 491ed1bb85759df2411706fd02d740acb5598ce6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Feb 20 14:34:51 2022 +0800 dry run mode commit dfd588dcef512ba7dfe760008bcf97138b97e339 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:14:32 2022 +0800 prettier commit eae580f882a045ae9df799b816e68c3500704131 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sat Feb 19 23:12:29 2022 +0800 draft design for sync algo v2
2022-02-27 09:54:31 +00:00
});
});
2021-11-09 02:00:44 +00:00
describe("Misc: vaild file name tests", () => {
it("should treat no ascii correctly", async () => {
const x = misc.isVaildText("😄🍎 apple 苹果");
// console.log(x)
2024-04-26 19:28:39 +00:00
assert.ok(x);
2021-11-09 02:00:44 +00:00
});
it("should find not-printable chars correctly", async () => {
const x = misc.isVaildText("😄🍎 apple 苹果\u0000");
// console.log(x)
2024-04-26 19:28:39 +00:00
assert.ok(!x);
2021-11-09 02:00:44 +00:00
});
it("should allow spaces/slashes/...", async () => {
const x = misc.isVaildText("😄🍎 apple 苹果/-_=/\\*%^&@#$`");
2024-04-26 19:28:39 +00:00
assert.ok(x);
2021-11-09 02:00:44 +00:00
});
});
2021-11-21 07:31:20 +00:00
describe("Misc: get dirname", () => {
it("should return itself for folder", async () => {
const x = misc.getPathFolder("ssss/");
// console.log(x)
2024-04-26 19:28:39 +00:00
assert.equal(x, "ssss/");
2021-11-21 07:31:20 +00:00
});
it("should return folder for file", async () => {
const x = misc.getPathFolder("sss/yyy");
// console.log(x)
2024-04-26 19:28:39 +00:00
assert.equal(x, "sss/");
2021-11-21 07:31:20 +00:00
});
it("should treat / specially", async () => {
const x = misc.getPathFolder("/");
2024-04-26 19:28:39 +00:00
assert.equal(x, "/");
2021-11-21 07:31:20 +00:00
const y = misc.getPathFolder("/abc");
2024-04-26 19:28:39 +00:00
assert.equal(y, "/");
2021-11-21 07:31:20 +00:00
});
});
2021-12-11 14:45:21 +00:00
describe("Misc: extract svg", () => {
2024-05-07 16:20:15 +00:00
beforeEach(() => {
2021-12-11 14:45:21 +00:00
const fakeBrowser = new JSDOM("");
global.window = fakeBrowser.window as any;
});
it("should extract rect from svg correctly", () => {
const x = "<svg><rect/><g/></svg>";
const y = misc.extractSvgSub(x);
// console.log(x)
2024-04-26 19:28:39 +00:00
assert.equal(y, "<rect/><g/>");
2021-12-11 14:45:21 +00:00
});
});
A big commit Squashed commit of CORS: commit 8cffa38ebae2a46b7c8e855c7b21a124e35adc89 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Mar 10 23:52:56 2022 +0800 bypass more cors for onedrive commit 1b59ac1e58032099068aab55d22ef96c6396f203 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:58:28 2022 +0800 change wordings for webdav cors commit 73142eb18b59fff20839680e866f51cfcb0a6226 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:38:58 2022 +0800 remove cors hint for webdav commit 7dbb0b49d50e529b2b72e55ea2c8503ba7fa9268 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:54 2022 +0800 fix webdav commit c28c4e19720a56230d483acf306463d42e619fa4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:35 2022 +0800 remove more headers commit 4eeae7043fa68d669a5c23c5549c14c1260ce638 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:18:32 2022 +0800 polish cors hints for s3 commit d9e55a91a1c413e9419cd6b30a3a6e3b403d483b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:40:37 2022 +0800 fix format commit b780a3eb4e37b05b8e8b92d6a2f9283b3459d738 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:37:02 2022 +0800 finally correctly inject requestUrl into s3 commit 6a55a1a43d7653d65579ab88aa816e5d54cd276a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:33:18 2022 +0800 to arraybuffer from view commit 2f2607b4f0a3d9db5943528ced57cb2fdb419607 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 13:31:22 2022 +0800 add split ranges commit ea24da24dea83fdb770e7e391cf8a2e4fea78d0d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:57:50 2022 +0800 add settings of bypassing for s3 commit 2f099dc8ca1e66ea137b28dd329be50968734ba6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:38:07 2022 +0800 use api ver var commit 74c7ce2449a88cbe7c7f50cbb687b36ff3732c04 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:37:25 2022 +0800 correct way to inject s3 commit f29945d73132d21b2c44472ec2cafc06b9d71e8f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Mar 1 00:09:57 2022 +0800 add new http handler commit d55104cb08e168cbcc243cf901cbd7f46f2e324b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 22:59:55 2022 +0800 add types for patch commit 50b79ade7188ee7dfab9c1d03119585db358ba6f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:19 2022 +0800 remove verbose commit 83f0e71aa15aa7586f6d4e105cd77c25c2e113ce Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:04 2022 +0800 patch webdav!
2022-03-10 15:54:35 +00:00
describe("Misc: get split ranges", () => {
it("should deal with big parts", () => {
const k = misc.getSplitRanges(10, 20);
const k2: misc.SplitRange[] = [
{
partNum: 1,
start: 0,
end: 10,
},
];
2024-04-26 19:28:39 +00:00
assert.deepEqual(k, k2);
A big commit Squashed commit of CORS: commit 8cffa38ebae2a46b7c8e855c7b21a124e35adc89 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Mar 10 23:52:56 2022 +0800 bypass more cors for onedrive commit 1b59ac1e58032099068aab55d22ef96c6396f203 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:58:28 2022 +0800 change wordings for webdav cors commit 73142eb18b59fff20839680e866f51cfcb0a6226 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:38:58 2022 +0800 remove cors hint for webdav commit 7dbb0b49d50e529b2b72e55ea2c8503ba7fa9268 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:54 2022 +0800 fix webdav commit c28c4e19720a56230d483acf306463d42e619fa4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:35 2022 +0800 remove more headers commit 4eeae7043fa68d669a5c23c5549c14c1260ce638 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:18:32 2022 +0800 polish cors hints for s3 commit d9e55a91a1c413e9419cd6b30a3a6e3b403d483b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:40:37 2022 +0800 fix format commit b780a3eb4e37b05b8e8b92d6a2f9283b3459d738 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:37:02 2022 +0800 finally correctly inject requestUrl into s3 commit 6a55a1a43d7653d65579ab88aa816e5d54cd276a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:33:18 2022 +0800 to arraybuffer from view commit 2f2607b4f0a3d9db5943528ced57cb2fdb419607 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 13:31:22 2022 +0800 add split ranges commit ea24da24dea83fdb770e7e391cf8a2e4fea78d0d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:57:50 2022 +0800 add settings of bypassing for s3 commit 2f099dc8ca1e66ea137b28dd329be50968734ba6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:38:07 2022 +0800 use api ver var commit 74c7ce2449a88cbe7c7f50cbb687b36ff3732c04 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:37:25 2022 +0800 correct way to inject s3 commit f29945d73132d21b2c44472ec2cafc06b9d71e8f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Mar 1 00:09:57 2022 +0800 add new http handler commit d55104cb08e168cbcc243cf901cbd7f46f2e324b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 22:59:55 2022 +0800 add types for patch commit 50b79ade7188ee7dfab9c1d03119585db358ba6f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:19 2022 +0800 remove verbose commit 83f0e71aa15aa7586f6d4e105cd77c25c2e113ce Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:04 2022 +0800 patch webdav!
2022-03-10 15:54:35 +00:00
});
it("should deal with 0 remainder", () => {
const k = misc.getSplitRanges(20, 10);
const k2: misc.SplitRange[] = [
{
partNum: 1,
start: 0,
end: 10,
},
{
partNum: 2,
start: 10,
end: 20,
},
];
2024-04-26 19:28:39 +00:00
assert.deepEqual(k, k2);
A big commit Squashed commit of CORS: commit 8cffa38ebae2a46b7c8e855c7b21a124e35adc89 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Mar 10 23:52:56 2022 +0800 bypass more cors for onedrive commit 1b59ac1e58032099068aab55d22ef96c6396f203 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:58:28 2022 +0800 change wordings for webdav cors commit 73142eb18b59fff20839680e866f51cfcb0a6226 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:38:58 2022 +0800 remove cors hint for webdav commit 7dbb0b49d50e529b2b72e55ea2c8503ba7fa9268 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:54 2022 +0800 fix webdav commit c28c4e19720a56230d483acf306463d42e619fa4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:35 2022 +0800 remove more headers commit 4eeae7043fa68d669a5c23c5549c14c1260ce638 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:18:32 2022 +0800 polish cors hints for s3 commit d9e55a91a1c413e9419cd6b30a3a6e3b403d483b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:40:37 2022 +0800 fix format commit b780a3eb4e37b05b8e8b92d6a2f9283b3459d738 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:37:02 2022 +0800 finally correctly inject requestUrl into s3 commit 6a55a1a43d7653d65579ab88aa816e5d54cd276a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:33:18 2022 +0800 to arraybuffer from view commit 2f2607b4f0a3d9db5943528ced57cb2fdb419607 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 13:31:22 2022 +0800 add split ranges commit ea24da24dea83fdb770e7e391cf8a2e4fea78d0d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:57:50 2022 +0800 add settings of bypassing for s3 commit 2f099dc8ca1e66ea137b28dd329be50968734ba6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:38:07 2022 +0800 use api ver var commit 74c7ce2449a88cbe7c7f50cbb687b36ff3732c04 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:37:25 2022 +0800 correct way to inject s3 commit f29945d73132d21b2c44472ec2cafc06b9d71e8f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Mar 1 00:09:57 2022 +0800 add new http handler commit d55104cb08e168cbcc243cf901cbd7f46f2e324b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 22:59:55 2022 +0800 add types for patch commit 50b79ade7188ee7dfab9c1d03119585db358ba6f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:19 2022 +0800 remove verbose commit 83f0e71aa15aa7586f6d4e105cd77c25c2e113ce Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:04 2022 +0800 patch webdav!
2022-03-10 15:54:35 +00:00
});
it("should deal with not-0 remainder", () => {
const k = misc.getSplitRanges(25, 10);
const k2: misc.SplitRange[] = [
{
partNum: 1,
start: 0,
end: 10,
},
{
partNum: 2,
start: 10,
end: 20,
},
{
partNum: 3,
start: 20,
end: 25,
},
];
2024-04-26 19:28:39 +00:00
assert.deepEqual(k, k2);
A big commit Squashed commit of CORS: commit 8cffa38ebae2a46b7c8e855c7b21a124e35adc89 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Thu Mar 10 23:52:56 2022 +0800 bypass more cors for onedrive commit 1b59ac1e58032099068aab55d22ef96c6396f203 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:58:28 2022 +0800 change wordings for webdav cors commit 73142eb18b59fff20839680e866f51cfcb0a6226 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:38:58 2022 +0800 remove cors hint for webdav commit 7dbb0b49d50e529b2b72e55ea2c8503ba7fa9268 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:54 2022 +0800 fix webdav commit c28c4e19720a56230d483acf306463d42e619fa4 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:31:35 2022 +0800 remove more headers commit 4eeae7043fa68d669a5c23c5549c14c1260ce638 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 23:18:32 2022 +0800 polish cors hints for s3 commit d9e55a91a1c413e9419cd6b30a3a6e3b403d483b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:40:37 2022 +0800 fix format commit b780a3eb4e37b05b8e8b92d6a2f9283b3459d738 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:37:02 2022 +0800 finally correctly inject requestUrl into s3 commit 6a55a1a43d7653d65579ab88aa816e5d54cd276a Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 22:33:18 2022 +0800 to arraybuffer from view commit 2f2607b4f0a3d9db5943528ced57cb2fdb419607 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Wed Mar 9 13:31:22 2022 +0800 add split ranges commit ea24da24dea83fdb770e7e391cf8a2e4fea78d0d Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:57:50 2022 +0800 add settings of bypassing for s3 commit 2f099dc8ca1e66ea137b28dd329be50968734ba6 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:38:07 2022 +0800 use api ver var commit 74c7ce2449a88cbe7c7f50cbb687b36ff3732c04 Author: fyears <1142836+fyears@users.noreply.github.com> Date: Sun Mar 6 22:37:25 2022 +0800 correct way to inject s3 commit f29945d73132d21b2c44472ec2cafc06b9d71e8f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Tue Mar 1 00:09:57 2022 +0800 add new http handler commit d55104cb08e168cbcc243cf901cbd7f46f2e324b Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 22:59:55 2022 +0800 add types for patch commit 50b79ade7188ee7dfab9c1d03119585db358ba6f Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:19 2022 +0800 remove verbose commit 83f0e71aa15aa7586f6d4e105cd77c25c2e113ce Author: fyears <1142836+fyears@users.noreply.github.com> Date: Mon Feb 28 08:25:04 2022 +0800 patch webdav!
2022-03-10 15:54:35 +00:00
});
});
describe("Misc: at which level", () => {
it("should throw error on some parameters", () => {
2024-04-26 19:28:39 +00:00
assert.throws(() => misc.atWhichLevel(undefined));
assert.throws(() => misc.atWhichLevel(""));
assert.throws(() => misc.atWhichLevel(".."));
assert.throws(() => misc.atWhichLevel("."));
assert.throws(() => misc.atWhichLevel("/"));
assert.throws(() => misc.atWhichLevel("/xxyy"));
});
it("should treat folders correctly", () => {
2024-04-26 19:28:39 +00:00
assert.equal(misc.atWhichLevel("x/"), 1);
assert.equal(misc.atWhichLevel("x/y/"), 2);
});
it("should treat files correctly", () => {
2024-04-26 19:28:39 +00:00
assert.equal(misc.atWhichLevel("x.md"), 1);
assert.equal(misc.atWhichLevel("x/y.md"), 2);
assert.equal(misc.atWhichLevel("x/y/z.md"), 3);
});
});
2022-03-28 16:12:58 +00:00
describe("Misc: special char for dir", () => {
it("should return false for normal string", () => {
2024-04-26 19:28:39 +00:00
assert.ok(!misc.checkHasSpecialCharForDir(""));
assert.ok(!misc.checkHasSpecialCharForDir("xxx"));
assert.ok(!misc.checkHasSpecialCharForDir("yyy_xxx"));
assert.ok(!misc.checkHasSpecialCharForDir("yyy.xxx"));
assert.ok(!misc.checkHasSpecialCharForDir("yyyxxx"));
2022-03-28 16:12:58 +00:00
});
it("should return true for special cases", () => {
2024-04-26 19:28:39 +00:00
assert.ok(misc.checkHasSpecialCharForDir("?"));
assert.ok(misc.checkHasSpecialCharForDir("/"));
assert.ok(misc.checkHasSpecialCharForDir("\\"));
assert.ok(misc.checkHasSpecialCharForDir("xxx/yyy"));
assert.ok(misc.checkHasSpecialCharForDir("xxx\\yyy"));
assert.ok(misc.checkHasSpecialCharForDir("xxx?yyy"));
2022-03-28 16:12:58 +00:00
});
});
2024-03-30 06:52:54 +00:00
2024-05-19 13:41:01 +00:00
describe("Misc: split chunk ranges", () => {
it("should fail on negative numner", () => {
assert.throws(() => misc.splitFileSizeToChunkRanges(-1, 2));
assert.throws(() => misc.splitFileSizeToChunkRanges(1, -1));
assert.throws(() => misc.splitFileSizeToChunkRanges(1, 0));
});
it("should return nothing for 0 input", () => {
let input: [number, number] = [0, 1];
let output: any = [];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [0, 100];
output = [];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
});
it("should return single item for 1 input", () => {
let input: [number, number] = [1, 1];
let output = [{ start: 0, end: 0 }];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [1, 100];
output = [{ start: 0, end: 0 }];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
});
it("should return single item for larger or equal input", () => {
let input: [number, number] = [10, 10];
let output = [{ start: 0, end: 9 }];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [10, 21];
output = [{ start: 0, end: 9 }];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
});
it("should return correct items for normal input", () => {
let input: [number, number] = [10, 9];
let output = [
{ start: 0, end: 8 },
{ start: 9, end: 9 },
];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [10, 5];
output = [
{ start: 0, end: 4 },
{ start: 5, end: 9 },
];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [3, 1];
output = [
{ start: 0, end: 0 },
{ start: 1, end: 1 },
{ start: 2, end: 2 },
];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [15, 5];
output = [
{ start: 0, end: 4 },
{ start: 5, end: 9 },
{ start: 10, end: 14 },
];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
input = [1024, 578];
output = [
{ start: 0, end: 577 },
{ start: 578, end: 1023 },
];
assert.deepStrictEqual(output, misc.splitFileSizeToChunkRanges(...input));
});
});
2024-03-30 06:52:54 +00:00
describe("Misc: Dropbox: should fix the folder name cases", () => {
it("should do nothing on empty folders", () => {
const input: any[] = [];
2024-04-26 19:28:39 +00:00
assert.equal(misc.fixEntityListCasesInplace(input).length, 0);
2024-03-30 06:52:54 +00:00
});
it("should sort folders by length by side effect", () => {
const input = [
{ keyRaw: "aaaa/" },
{ keyRaw: "bbb/" },
{ keyRaw: "c/" },
{ keyRaw: "dd/" },
];
const output = [
{ keyRaw: "c/" },
{ keyRaw: "dd/" },
{ keyRaw: "bbb/" },
{ keyRaw: "aaaa/" },
];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.fixEntityListCasesInplace(input), output);
2024-03-30 06:52:54 +00:00
});
it("should fix folder names", () => {
const input = [
{ keyRaw: "AAA/" },
{ keyRaw: "aaa/bbb/CCC.md" },
{ keyRaw: "aaa/BBB/" },
{ keyRaw: "ddd/" },
{ keyRaw: "DDD/EEE/fff.md" },
{ keyRaw: "DDD/eee/" },
{ keyRaw: "Ggg/" },
{ keyRaw: "ggG/hHH你好/Fff世界.md" },
{ keyRaw: "ggG/Hhh你好/" },
];
const output = [
{ keyRaw: "AAA/" },
{ keyRaw: "ddd/" },
{ keyRaw: "Ggg/" },
{ keyRaw: "AAA/BBB/" },
{ keyRaw: "ddd/eee/" },
{ keyRaw: "Ggg/Hhh你好/" },
{ keyRaw: "AAA/BBB/CCC.md" },
{ keyRaw: "ddd/eee/fff.md" },
{ keyRaw: "Ggg/Hhh你好/Fff世界.md" },
];
2024-04-26 19:28:39 +00:00
assert.deepEqual(misc.fixEntityListCasesInplace(input), output);
2024-03-30 06:52:54 +00:00
});
});