Files
OmniRoute/tests/unit/tencent-aistudio-web.test.ts
Reza Rezaei 774127be3f feat(providers): add tencent-aistudio-web cookie provider (tasw) (#10174)
* feat(providers): add tencent-aistudio-web cookie provider (tasw)

* fix(sse): remove orphaned DevinDesktopExecutor import from executor index

The "devin-desktop" executor key is unused (devin-desktop provider config
resolves to executor "devin-cli"); the imported ./devin-desktop.ts file
was never present, so executors/index.ts failed to load (ERR_MODULE_NOT_FOUND)
and broke every unit test that imports the executor registry (e.g.
tests/unit/deepseek-web.test.ts). Stale base sync carried this into the branch.
Remove the dead import/registration/export.

* fix(providers): restore DevinDesktopExecutor registration in executor index

The previous commit removed the devin-desktop executor import/registration/
export from open-sse/executors/index.ts, but the devin-desktop provider
registry still resolves executor "devin-desktop" and
tests/unit/devin-providers.test.ts asserts hasSpecializedExecutor("devin-desktop")
is true. The removal broke 6 tests in that file. Restore the three lines so
the live Devin Desktop executor keeps serving the provider.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(providers): correct tencent-aistudio-web wrapper shape + provider count sync

Return {response,url,headers,transformedBody} instead of a raw fetch Response
(the executor contract every other executor in this file follows) and
re-wrap the upstream body so it uses the local Response constructor, not the
undici-patched one from globalThis.fetch.

Regenerate docs/reference/PROVIDER_REFERENCE.md and sync the 339->340
provider-count claims (README, AGENTS.md, llm.txt + 42 i18n mirrors,
package.json, promise-pillars/comparison-table/cli-terminal SVGs) that this
PR's new provider invalidated.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* docs(providers): sync readme-hero.svg provider count claim (339->340)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(providers): register tencent-aistudio-web web-session credential metadata + golden

Add the WEB_SESSION_CREDENTIAL_REQUIREMENTS entry for tencent-aistudio-web
(cookie-based, matching the executor's raw Cookie-header credential) and
regenerate the translate-path golden snapshot to include the new provider —
both were failing CI unit tests that enumerate every registered provider.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(providers): align tencent-aistudio-web test with the wrapper-shape contract

The test asserted res.status/res.json() directly against executor.execute()'s
return value, matching the pre-fix (broken) raw-Response shape. Update it to
read res.response.status/res.response.json() — the {response,url,headers,
transformedBody} contract every executor in this codebase follows.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: MeRezaRezaei <MeRezaRezaei@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
2026-08-15 05:15:17 -03:00

36 lines
1.3 KiB
TypeScript

import assert from "node:assert";
import { tencent_aistudio_webProvider } from "../../open-sse/config/providers/registry/tencent-aistudio-web/index.ts";
import executor from "../../open-sse/executors/tencent-aistudio-web.ts";
async function runTests() {
// Test registry
assert.strictEqual(tencent_aistudio_webProvider.id, "tencent-aistudio-web");
assert.strictEqual(tencent_aistudio_webProvider.alias, "tasw");
assert.strictEqual(tencent_aistudio_webProvider.format, "openai");
assert.strictEqual(tencent_aistudio_webProvider.executor, "tencent-aistudio-web");
assert(tencent_aistudio_webProvider.models.length > 0);
const modelIds = tencent_aistudio_webProvider.models.map((m) => m.id);
assert(modelIds.includes("hy3-g"));
// Test executor missing cookie
const input = {
model: "hy3-g",
body: { model: "hy3-g", messages: [{ role: "user", content: "hi" }] },
stream: false,
credentials: { apiKey: "" },
} as unknown as Parameters<typeof executor.execute>[0];
const res = await executor.execute(input);
assert.strictEqual(res.response.status, 401);
const data = await res.response.json();
assert(data.error.message.includes("Cookie"));
console.log("All Tencent AI Studio Web tests passed!");
}
runTests().catch((err) => {
console.error("Test failed:", err);
process.exit(1);
});