1Branch0Tags
GL
glucryptoRefresh package-lock for opentool 0.19.5
01acdef14 hours ago17Commits
typescript
import { describe, expect, test } from "bun:test"; import { downsampleBacktestCheckpoints } from "./news-backtest"; describe("downsampleBacktestCheckpoints", () => { test("keeps the original list when it is already within the cap", () => { const checkpoints = [ "2026-03-18T00:00:00.000Z", "2026-03-19T00:00:00.000Z", "2026-03-20T00:00:00.000Z", ]; expect(downsampleBacktestCheckpoints(checkpoints, 3)).toEqual(checkpoints); }); test("preserves the start and end checkpoints while reducing intermediate points", () => { const checkpoints = [ "2026-03-18T00:00:00.000Z", "2026-03-19T00:00:00.000Z", "2026-03-20T00:00:00.000Z", "2026-03-21T00:00:00.000Z", "2026-03-22T00:00:00.000Z", "2026-03-23T00:00:00.000Z", "2026-03-24T00:00:00.000Z", ]; expect(downsampleBacktestCheckpoints(checkpoints, 3)).toEqual([ "2026-03-18T00:00:00.000Z", "2026-03-21T00:00:00.000Z", "2026-03-24T00:00:00.000Z", ]); }); });