Files
openchamber/packages/web/server/lib/quota/utils/formatters.test.js
T
Isaac Sanchez-HawkinsandIsaac Sanchez b944bd812c fix(quota): ignore invalid reset timestamps (#1182)
* fix(quota): ignore invalid reset timestamps

* fix(quota): guard reset-after timestamps

---------

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
2026-05-12 11:05:22 +03:00

22 lines
780 B
JavaScript

import { describe, expect, it } from 'vitest';
import { calculateResetAfterSeconds, formatResetTime } from './formatters.js';
describe('formatResetTime', () => {
it('returns null for invalid timestamps', () => {
expect(formatResetTime('not-a-date')).toBeNull();
expect(formatResetTime(NaN)).toBeNull();
expect(formatResetTime(Infinity)).toBeNull();
expect(formatResetTime(-Infinity)).toBeNull();
});
});
describe('calculateResetAfterSeconds', () => {
it('returns null for invalid timestamps', () => {
expect(calculateResetAfterSeconds('not-a-date')).toBeNull();
expect(calculateResetAfterSeconds(NaN)).toBeNull();
expect(calculateResetAfterSeconds(Infinity)).toBeNull();
expect(calculateResetAfterSeconds(-Infinity)).toBeNull();
});
});