Download __tests__/scripts/dev-static.test.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/__tests__/scripts/dev-static.test.ts
- Command line
-
hf download hf://SaylorTwift/openhands/__tests__/scripts/dev-static.test.ts
-
curl -L -o dev-static.test.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/__tests__/scripts/dev-static.test.ts
1.47 kB
| import { describe, expect, it } from "vitest"; | |
| import { | |
| buildAutomationBackendEnv, | |
| buildLocalServiceRouteArgs, | |
| } from "../../scripts/dev-static.mjs"; | |
| describe("dev-static", () => { | |
| it("uses the same session key for both agent-server and automation backend auth", () => { | |
| const env = buildAutomationBackendEnv( | |
| { | |
| agentServerPort: 18000, | |
| ingressPort: 8000, | |
| sessionApiKey: "shared-session-key", | |
| stateDir: "/tmp/agent-canvas-state", | |
| }, | |
| {}, | |
| ); | |
| // Both backends receive the same key value | |
| expect(env).toMatchObject({ | |
| AUTOMATION_AGENT_SERVER_URL: "http://127.0.0.1:18000", | |
| AUTOMATION_AGENT_SERVER_API_KEY: "shared-session-key", | |
| AUTOMATION_LOCAL_API_KEY: "shared-session-key", | |
| AUTOMATION_POSTHOG_API_KEY: | |
| "phc_kBtz5nKmxVRRQ7HtPwr2QX9eMC5j65zE86QKocVNwb4U", | |
| AUTOMATION_POSTHOG_HOST: "https://us.i.posthog.com", | |
| }); | |
| }); | |
| it("points every local proxy route at the IPv4 loopback", () => { | |
| // Both backends bind to `0.0.0.0`, which only accepts IPv4, so a | |
| // `localhost` target strands the proxy on ::1 on Windows. | |
| const args = buildLocalServiceRouteArgs({ | |
| agentServerPort: 18000, | |
| autoBackendPort: 18001, | |
| }); | |
| expect(args).toContain("/api/automation=http://127.0.0.1:18001"); | |
| expect(args).toContain("/server_info=http://127.0.0.1:18000"); | |
| expect(args.filter((arg: string) => arg.includes("localhost"))).toEqual([]); | |
| }); | |
| }); | |