mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
feat: move snippets, keybinding actions and macros out of core into plugins
This commit is contained in:
1 parent
d9bba10612
commit
e0c30a4e6f
262 files changed
+9091
-10744
No files matched your search
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { validateAdminSettings } from "../../src/backend/settings-validation.js";
|
||||
import {
|
||||
validateAdminSettings,
|
||||
validateUserSettings,
|
||||
} from "../../src/backend/settings-validation.js";
|
||||
|
||||
describe("validateAdminSettings", () => {
|
||||
it("rejects relative image paths", () => {
|
||||
@@ -19,3 +22,28 @@ describe("validateAdminSettings", () => {
|
||||
).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
describe("validateUserSettings", () => {
|
||||
const macro = { id: "m", name: "M", steps: [] };
|
||||
|
||||
it("accepts bounded macros and a save without them", () => {
|
||||
expect(validateUserSettings({ macros: [macro] })).toEqual({});
|
||||
expect(validateUserSettings({ macros: JSON.stringify([macro]) })).toEqual(
|
||||
{},
|
||||
);
|
||||
expect(validateUserSettings({ localEcho: "on" })).toEqual({});
|
||||
});
|
||||
|
||||
it("refuses malformed or too many macros", () => {
|
||||
expect(validateUserSettings({ macros: [{ id: 1 }] }).macros).toBeTruthy();
|
||||
expect(validateUserSettings({ macros: "{" }).macros).toBeTruthy();
|
||||
expect(
|
||||
validateUserSettings({
|
||||
macros: Array.from({ length: 101 }, (_, i) => ({
|
||||
...macro,
|
||||
id: `${i}`,
|
||||
})),
|
||||
}).macros,
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user