test: correct fixture and abort harness

Co-authored-by: Simon Shi <simonsmh@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-31 16:28:09 +00:00
co-authored by Simon Shi
parent 3d7df5d1e4
commit ca17a95270
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ afterEach(() => {
describe("Qoder model cache", () => {
it.each([
["global", ["Lite", "GLM5.2"]],
["cn", ["Auto", "Qwen3.7-Max"]],
["cn", ["Qwen3.7Plus"]],
] as const)("maps the %s recorded-format catalog to friendly picker ids", async (region, expectedIds) => {
const interaction = loadLiveFixture(region).interactions.modelList;
vi.stubGlobal("fetch", vi.fn().mockResolvedValue(responseFromFixture(interaction)));
+4
View File
@@ -432,6 +432,10 @@ describe("streamQoder", () => {
globalThis.fetch = vi.fn(
(_url: URL | RequestInfo, init?: RequestInit) =>
new Promise<Response>((_resolve, reject) => {
if (init?.signal?.aborted) {
reject(new DOMException("Aborted", "AbortError"));
return;
}
init?.signal?.addEventListener("abort", () => reject(new DOMException("Aborted", "AbortError")), {
once: true,
});