remotely-save/tests/configPersist.test.ts

37 lines
892 B
TypeScript
Raw Normal View History

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"],
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
});
});