qbo_auth: журнал действий страницы ручных тестов (ручной тест: действие и результат)
All checks were successful
ci / test (push) Successful in 38s
ci / deploy (push) Successful in 2m41s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 09:34:06 +03:00
parent 9a1a2a8a6b
commit 081ab16915
4 changed files with 37 additions and 9 deletions

View File

@@ -32,7 +32,8 @@ describe("вебхук Intuit", () => {
});
it("страница тестов: только по секретному адресу, заголовки без кэша, заметка принимается", async () => {
const app = buildApi({} as QboAuth, "svc");
const audit = { info: vi.fn() };
const app = buildApi({} as QboAuth, "svc", undefined, undefined, audit);
const slug = testsSlug("svc");
expect(slug).toMatch(/^[0-9a-f]{32}$/);
expect((await app.inject({ url: "/tests/wrong" })).statusCode).toBe(404);
@@ -46,6 +47,7 @@ describe("вебхук Intuit", () => {
const h = { "content-type": "application/json" };
expect((await app.inject({ method: "POST", url: `/tests/${slug}/note`, headers: h, payload: { text: "Bill 12.50" } })).statusCode).toBe(200);
expect((await app.inject({ method: "POST", url: `/tests/${slug}/note`, headers: h, payload: { text: " " } })).statusCode).toBe(400);
expect(audit.info).toHaveBeenCalledWith({ action: "note", note: "Bill 12.50" }, "ручной тест");
});
it("вебхук с типом application/cloudevents+json принимается (раньше было 415)", async () => {