LibreChat/client/src/components/Insights/dateRange.spec.ts
Ravi Kumar L 006e421cd2
💡 feat: add DB-backed admin insights (#14898)
* feat: add Mongo-backed admin insights

* feat: gate insights with environment variable

* fix: tighten insights access and activity metrics

* fix: preserve insights date selections

* perf: parallelize insights search aggregation

* test: wait for MCP conflict recovery

* test: satisfy strict MCP recovery typing

* fix: disable insights pagination while loading

* fix: localize insights range shortcuts

* fix: bound insights search input
2026-08-18 07:51:51 -04:00

12 lines
431 B
TypeScript

import { getRollingDateRange } from './dateRange';
describe('Insights date ranges', () => {
it('builds shortcut bounds from the same rolling duration as the query', () => {
const endDate = new Date(2026, 7, 31, 15, 30);
const range = getRollingDateRange(endDate, 30);
expect(range.endDate.getTime() - range.startDate.getTime()).toBe(30 * 24 * 60 * 60 * 1000);
expect(range.endDate).toEqual(endDate);
});
});