/
githubmirror
/
ChatGPT-Next-Web
Обзор
Документация
Войти
/
githubmirror
/
ChatGPT-Next-Web
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/cloudflare.test.ts
28 строк
1 KB
TIANQIAN1238
test: add unit tests for cloudflareAIGatewayUrl
06 июл 2026, 07:23
06 июл 2026, 07:23
50063cf
Код
Авторство
О чём код?
import { cloudflareAIGatewayUrl } from "../app/utils/cloudflare"; describe("cloudflareAIGatewayUrl", () => { test("returns non-gateway urls unchanged", () => { const url = "https://api.openai.com/v1/chat/completions"; expect(cloudflareAIGatewayUrl(url)).toBe(url); }); test("keeps a well-formed openai gateway url intact", () => { const url = "https://gateway.ai.cloudflare.com/v1/acc/gw/openai/chat/completions"; expect(cloudflareAIGatewayUrl(url)).toBe(url); }); test("rebuilds an openai gateway url by dropping middle segments", () => { const url = "https://gateway.ai.cloudflare.com/v1/acc/gw/openai/extra/more/chat/completions"; expect(cloudflareAIGatewayUrl(url)).toBe( "https://gateway.ai.cloudflare.com/v1/acc/gw/openai/chat/completions", ); }); test("keeps a well-formed azure gateway url intact", () => { const url = "https://gateway.ai.cloudflare.com/v1/acc/gw/azure-openai/resource/deploy/chat/completions"; expect(cloudflareAIGatewayUrl(url)).toBe(url); }); });