diff --git a/src/lib/availability/availability-service.ts b/src/lib/availability/availability-service.ts index 28cee31e8..ac732dbc8 100644 --- a/src/lib/availability/availability-service.ts +++ b/src/lib/availability/availability-service.ts @@ -50,15 +50,17 @@ const MAX_AVAILABILITY_QUERY_RANGE_MS = MAX_BUCKETS_HARD_LIMIT * MAX_BUCKET_SIZE_MINUTES * 60 * 1000; function floorToUtcMinute(date: Date): Date { - return new Date(Date.UTC( - date.getUTCFullYear(), - date.getUTCMonth(), - date.getUTCDate(), - date.getUTCHours(), - date.getUTCMinutes(), - 0, - 0 - )); + return new Date( + Date.UTC( + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + date.getUTCHours(), + date.getUTCMinutes(), + 0, + 0 + ) + ); } export class AvailabilityQueryValidationError extends Error { diff --git a/tests/unit/lib/availability/projection-worker.test.ts b/tests/unit/lib/availability/projection-worker.test.ts index baa653709..da269df1b 100644 --- a/tests/unit/lib/availability/projection-worker.test.ts +++ b/tests/unit/lib/availability/projection-worker.test.ts @@ -72,8 +72,9 @@ describe("availability projection-worker", () => { } return []; }); - const transactionMock = vi.fn(async (fn: (tx: { execute: typeof executeMock }) => Promise) => - fn({ execute: executeMock }) + const transactionMock = vi.fn( + async (fn: (tx: { execute: typeof executeMock }) => Promise) => + fn({ execute: executeMock }) ); vi.doMock("@/drizzle/db", () => ({ @@ -97,9 +98,9 @@ describe("availability projection-worker", () => { expect(texts.some((t) => t.includes("insert into avail_bucket_1m"))).toBe(true); expect(texts.some((t) => t.includes("insert into avail_current"))).toBe(true); expect(texts.some((t) => t.includes("15 * interval '1 minute'"))).toBe(true); - expect(texts.some((t) => t.includes("update outbox_events") && t.includes("published_at"))).toBe( - true - ); + expect( + texts.some((t) => t.includes("update outbox_events") && t.includes("published_at")) + ).toBe(true); }); it("processBatch 对重复 request 不重复计数", async () => { @@ -125,8 +126,9 @@ describe("availability projection-worker", () => { } return []; }); - const transactionMock = vi.fn(async (fn: (tx: { execute: typeof executeMock }) => Promise) => - fn({ execute: executeMock }) + const transactionMock = vi.fn( + async (fn: (tx: { execute: typeof executeMock }) => Promise) => + fn({ execute: executeMock }) ); vi.doMock("@/drizzle/db", () => ({ @@ -165,8 +167,9 @@ describe("availability projection-worker", () => { } return []; }); - const transactionMock = vi.fn(async (fn: (tx: { execute: typeof executeMock }) => Promise) => - fn({ execute: executeMock }) + const transactionMock = vi.fn( + async (fn: (tx: { execute: typeof executeMock }) => Promise) => + fn({ execute: executeMock }) ); vi.doMock("@/drizzle/db", () => ({