2024-04-26 19:28:39 +00:00
|
|
|
import { strict as assert } from "assert";
|
2022-01-05 02:04:58 +00:00
|
|
|
|
|
|
|
import { RemotelySavePluginSettings } from "../src/baseTypes";
|
|
|
|
import { messyConfigToNormal, normalConfigToMessy } from "../src/configPersist";
|
|
|
|
|
|
|
|
const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
|
|
|
|
s3: {
|
|
|
|
s3AccessKeyID: "acc",
|
|
|
|
} as any,
|
|
|
|
webdav: {
|
|
|
|
address: "addr",
|
|
|
|
} as any,
|
|
|
|
dropbox: {
|
|
|
|
username: "测试中文",
|
|
|
|
} as any,
|
|
|
|
onedrive: {
|
|
|
|
username: "test 🍎 emoji",
|
|
|
|
} as any,
|
2024-04-27 15:10:36 +00:00
|
|
|
webdis: {
|
|
|
|
address: "addr",
|
|
|
|
} as any,
|
2022-01-05 02:04:58 +00:00
|
|
|
password: "password",
|
|
|
|
serviceType: "s3",
|
|
|
|
currLogLevel: "info",
|
2024-01-05 15:07:15 +00:00
|
|
|
ignorePaths: ["somefoldertoignore"],
|
2022-08-13 09:55:19 +00:00
|
|
|
enableStatusBarInfo: true,
|
2022-01-05 02:04:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
describe("Config Persist tests", () => {
|
|
|
|
it("should encrypt go back and forth conrrectly", async () => {
|
|
|
|
const k = DEFAULT_SETTINGS;
|
|
|
|
const k2 = normalConfigToMessy(k);
|
|
|
|
const k3 = messyConfigToNormal(k2);
|
2024-04-26 19:28:39 +00:00
|
|
|
assert.deepEqual(k3, k);
|
2022-01-05 02:04:58 +00:00
|
|
|
});
|
|
|
|
});
|