Skip to content

Commit

Permalink
test: prevent empty timeline dbFallback in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Jul 31, 2024
1 parent 1999a5e commit 92a55ad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/backend/src/core/FanoutTimelineEndpointService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 92a55ad

Please sign in to comment.