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>
This commit is contained in:
committed by
GitHub
co-authored by
Isaac Sanchez
parent
323347f50e
commit
b944bd812c
@@ -0,0 +1,21 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user