|
| 1 | +import { readFileSync } from "node:fs" |
1 | 2 | import { describe, expect, it } from "@effect/vitest" |
2 | 3 |
|
3 | 4 | import { defaultTemplateConfig, type TemplateConfig } from "../../src/core/domain.js" |
@@ -46,6 +47,17 @@ describe("renderEntrypointDnsRepair", () => { |
46 | 47 | expect(dnsRepairIndex).toBeGreaterThanOrEqual(0) |
47 | 48 | expect(packageCacheIndex).toBeGreaterThan(dnsRepairIndex) |
48 | 49 | }) |
| 50 | + |
| 51 | + it("renders public API guidance in managed prompts without localhost fallback links", () => { |
| 52 | + const entrypoint = renderEntrypoint(makeTemplateConfig()) |
| 53 | + |
| 54 | + expect(entrypoint).toContain("DOCKER_GIT_API_PUBLIC_URL=\"${DOCKER_GIT_API_PUBLIC_URL:-}\"") |
| 55 | + expect(entrypoint).toContain('PUBLIC_API_URL_VALUE="${DOCKER_GIT_API_PUBLIC_URL:-}"') |
| 56 | + expect(entrypoint).toContain("Публичный API docker-git: не задан.") |
| 57 | + expect(entrypoint).toContain( |
| 58 | + "Если пользователь просит ссылку на docker-git API или просит выполнить API-вызов, используй только публичный API адрес выше. Никогда не подставляй localhost/127.0.0.1." |
| 59 | + ) |
| 60 | + }) |
49 | 61 | }) |
50 | 62 |
|
51 | 63 | describe("renderEntrypointGitHooks", () => { |
@@ -109,4 +121,13 @@ describe("renderDockerCompose", () => { |
109 | 121 | expect(browserDnsIndex).toBeGreaterThan(browserServiceIndex) |
110 | 122 | expect((compose.match(/\n dns:\n/g) ?? []).length).toBe(2) |
111 | 123 | }) |
| 124 | + |
| 125 | + it("passes through the public API URL to the api compose service", () => { |
| 126 | + const apiCompose = readFileSync( |
| 127 | + new URL("../../../../docker-compose.api.yml", import.meta.url), |
| 128 | + "utf8" |
| 129 | + ) |
| 130 | + |
| 131 | + expect(apiCompose).toContain("DOCKER_GIT_API_PUBLIC_URL: ${DOCKER_GIT_API_PUBLIC_URL:-}") |
| 132 | + }) |
112 | 133 | }) |
0 commit comments