mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-29 08:06:46 +00:00
Dev servers bind to localhost by default (new --host option) and sync keeps paths within the project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
836 B
TypeScript
31 lines
836 B
TypeScript
import { expect, test } from "bun:test";
|
|
import { join } from "node:path";
|
|
import { remoteKeyWithinFolder } from "../src/commands/sync/sync.ts";
|
|
|
|
const FILESET = join("f", "res", "data.fileset");
|
|
|
|
test("fileset keys and module names land inside their folder", () => {
|
|
expect(remoteKeyWithinFolder(FILESET, "q.sql")).toBe(join(FILESET, "q.sql"));
|
|
expect(remoteKeyWithinFolder(FILESET, "models/staging/a.sql")).toBe(
|
|
join(FILESET, "models", "staging", "a.sql"),
|
|
);
|
|
});
|
|
|
|
test("fileset keys that are not plain relative paths are refused", () => {
|
|
for (const key of [
|
|
"../cleanup.sh",
|
|
"a/../../b.sh",
|
|
"/etc/cron.d/x",
|
|
"C:/x.ts",
|
|
"a\\..\\..\\b.ts",
|
|
"a\0b",
|
|
"a//b",
|
|
"./a",
|
|
"",
|
|
]) {
|
|
expect(() => remoteKeyWithinFolder(FILESET, key)).toThrow(
|
|
/must be a relative path/,
|
|
);
|
|
}
|
|
});
|