test: correct fixture and abort harness
Co-authored-by: Simon Shi <simonsmh@users.noreply.github.com>
This commit is contained in:
co-authored by
Simon Shi
parent
3d7df5d1e4
commit
ca17a95270
@@ -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)));
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user