add validation, helpers, tests

This commit is contained in:
Alex Holliday committed 2026-09-10 12:23:20 -07:00
1 parent 131fd1a6b0
commit 5eb16fdbdb
13 files changed
+249 -13

No files matched your search

@@ -620,8 +620,23 @@ describe("monitorValidation — Docker host url", () => {
expect(parsed.url).toBe("/run/docker.sock");
});
it("accepts tcp:// and https:// engine urls with an optional port and trailing slash", () => {
for (const url of ["tcp://host", "tcp://host:2376", "https://host:2377", "tcp://host/"]) {
expect(createMonitorBodyValidation.parse({ ...baseDockerBody, url }).url).toBe(url);
}
});
it("rejects container names and unsupported engine urls", () => {
for (const badUrl of ["my-container", "tcp://host:2375", "https://host", "ssh://deploy@host", "unix://relative/path", ""]) {
for (const badUrl of [
"my-container",
"http://host",
"host:2376",
"tcp://host/x",
"tcp://host:abc",
"ssh://deploy@host",
"unix://relative/path",
"",
]) {
expect(() => createMonitorBodyValidation.parse({ ...baseDockerBody, url: badUrl })).toThrow();
}
});