This commit is contained in:
2026-07-26 14:02:37 +07:00
parent bc56546b49
commit 367ebc1c7f
171 changed files with 4617 additions and 10402 deletions
+22
View File
@@ -567,6 +567,28 @@ describe("Models runtime", () => {
await expect(oauthModels.getAuth("p1")).rejects.toMatchObject({ code: "auth" });
});
it("keeps the underlying reason in wrapped oauth refresh errors", async () => {
const credentials = new InMemoryCredentialStore();
await credentials.modify("p1", async () => ({ type: "oauth", access: "old", refresh: "r", expires: 0 }));
const models = createModels({ credentials });
models.setProvider(
testProvider({
id: "p1",
auth: {
oauth: testOAuth({
refresh: async () => {
throw new Error("token refresh failed (400): invalid_grant");
},
}),
},
}),
);
await expect(models.getAuth("p1")).rejects.toThrow(
"OAuth refresh failed for p1: token refresh failed (400): invalid_grant",
);
});
it("wraps api-key auth failures in ModelsError", async () => {
const failing: ApiKeyAuth = {
name: "Failing",