13 lines
659 B
TypeScript
13 lines
659 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { historicalSamplesFromData } from '../../src/liveBuffer';
|
|
|
|
describe('historical metric boundary', () => {
|
|
it('caps oversized upstream payloads before they enter chart state', () => {
|
|
const values = Array.from({ length: 12_000 }, (_, index) => [1_700_000_000 + index, String(index)]);
|
|
const result = historicalSamplesFromData({ result: Array.from({ length: 120 }, (_, index) => ({ metric: { host: `host-${index}` }, values })) });
|
|
expect(result).toHaveLength(10_000);
|
|
expect(new Set(result.map((sample) => sample.series)).size).toBe(1);
|
|
expect(result[0].value).toBe(2000);
|
|
});
|
|
});
|