From 92a55ade4300aecc2a4d49e8f82f75893b0534c6 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 1 Aug 2024 01:51:08 +0900 Subject: [PATCH] test: prevent empty timeline dbFallback in test mode --- packages/backend/src/core/FanoutTimelineEndpointService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/backend/src/core/FanoutTimelineEndpointService.ts b/packages/backend/src/core/FanoutTimelineEndpointService.ts index 7ce54e0bfe32..4c8f846a7201 100644 --- a/packages/backend/src/core/FanoutTimelineEndpointService.ts +++ b/packages/backend/src/core/FanoutTimelineEndpointService.ts @@ -59,6 +59,9 @@ export class FanoutTimelineEndpointService { // 呼び出し元と以下の処理をシンプルにするためにdbFallbackを置き換える if (!ps.useDbFallback) ps.dbFallback = () => Promise.resolve([]); + // テストの際は空のtimelineが他の判定のテストの悪影響になるので空タイムラインによるdb fallbackを無効化する + if (process.env.NODE_ENV === 'test') ps.preventEmptyTimelineDbFallback = true; + const ascending = ps.sinceId && !ps.untilId; const idCompare: (a: string, b: string) => number = ascending ? (a, b) => a < b ? -1 : 1 : (a, b) => a > b ? -1 : 1;