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
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveCommandVariables } from "../../src/backend/routes.js";
|
||||
|
||||
function registry(value?: unknown) {
|
||||
return {
|
||||
registry: {
|
||||
provide: () => {},
|
||||
revoke: () => false,
|
||||
consume: <T>() => value as T | undefined,
|
||||
},
|
||||
} as never;
|
||||
}
|
||||
|
||||
describe("resolveCommandVariables", () => {
|
||||
it("fills variables through the snippets plugin's resolver", () => {
|
||||
const ctx = registry({
|
||||
resolve: (content: string, host: { ip?: string } | null) =>
|
||||
content.replace("$HOST", host?.ip ?? ""),
|
||||
});
|
||||
expect(resolveCommandVariables(ctx, "ping $HOST", { ip: "10.0.0.1" })).toBe(
|
||||
"ping 10.0.0.1",
|
||||
);
|
||||
});
|
||||
|
||||
it("runs the command as typed while snippets is off", () => {
|
||||
expect(
|
||||
resolveCommandVariables(registry(), "ping $HOST", { ip: "10.0.0.1" }),
|
||||
).toBe("ping $HOST");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user