qbo_auth: realmId шифруется, /callback отвечает 302, no-cache; требования Intuit: раздел E по оригиналу, ручные тесты через /tests
All checks were successful
ci / test (push) Successful in 38s
ci / deploy (push) Successful in 2m38s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 09:21:39 +03:00
parent b0a68930b1
commit e90b9f352d
7 changed files with 65 additions and 34 deletions

View File

@@ -133,8 +133,10 @@ describe("HTTP", () => {
const url = (await app.inject({ method: "POST", url: "/connect", headers: { authorization: "Bearer tok" } })).json().url as string;
const state = new URL(url).searchParams.get("state")!;
const cb = await app.inject({ url: `/callback?code=c&state=${state}&realmId=R1` });
expect(cb.statusCode).toBe(200);
expect(cb.body).toContain("подключён");
expect(cb.statusCode).toBe(302);
expect(cb.headers.location).toBe("/api/qbo/connected?ok=1");
expect(cb.body).not.toContain("html");
expect((await app.inject({ url: "/connected?ok=1" })).body).toContain("подключён");
const st = await app.inject({ url: "/status", headers: { authorization: "Bearer tok" } });
expect(st.json()).toMatchObject({ connected: true, realmId: "R1" });
expect(st.body).not.toContain("at1");
@@ -144,8 +146,9 @@ describe("HTTP", () => {
it("/callback с плохим state: 400 и страница без подробностей", async () => {
const app = buildApi(mk([]).auth, "tok");
const r = await app.inject({ url: "/callback?code=c&state=bad&realmId=R" });
expect(r.statusCode).toBe(400);
expect(r.body).not.toContain("state");
expect(r.statusCode).toBe(302);
expect(r.headers.location).toBe("/api/qbo/connected?ok=0");
expect((await app.inject({ url: "/connected?ok=0" })).statusCode).toBe(400);
});
it("/token: без подключения - 409 reauth_needed; с подключением - токен", async () => {