Publish curated ITWorx-Pulse source from 0e0633c8ac91cb71312a26837f791035a78d81b8
Public source validation / validate (push) Failing after 2m10s
Public source validation / validate (push) Failing after 2m10s
This commit is contained in:
1 parent
a4956c2af9
commit
db8093b608
88 files changed
+3685
-469
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { rangeForPreset, rangeForSelection } from '../../src/metricClient';
|
||||
|
||||
describe('metric range selection', () => {
|
||||
const now = new Date('2026-08-30T18:00:00.000Z');
|
||||
|
||||
it('supports the 30 day operator preset within the existing point budget', () => {
|
||||
const range = rangeForPreset('30d', now);
|
||||
expect(range.to).toBe(now.toISOString());
|
||||
expect(Date.parse(range.to) - Date.parse(range.from)).toBe(30 * 24 * 60 * 60 * 1000);
|
||||
expect(range.stepSeconds).toBeGreaterThanOrEqual(15);
|
||||
});
|
||||
|
||||
it('turns a valid custom selection into an exact UTC range', () => {
|
||||
const range = rangeForSelection('custom|2026-08-01T10:00:00.000Z|2026-08-02T10:00:00.000Z', now);
|
||||
expect(range.from).toBe('2026-08-01T10:00:00.000Z');
|
||||
expect(range.to).toBe('2026-08-02T10:00:00.000Z');
|
||||
});
|
||||
|
||||
it('fails closed to one hour when a custom range is invalid', () => {
|
||||
expect(rangeForSelection('custom|broken|2026-08-02T10:00:00.000Z', now)).toEqual(rangeForPreset('1h', now));
|
||||
});
|
||||
|
||||
it('uses bounded recent history while live transport is paused', () => {
|
||||
expect(rangeForSelection('paused', now)).toEqual(rangeForPreset('live', now));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user