Fixes #1982 With a refID of `test test` <img width="273" height="223" alt="Screenshot 2025-08-06 at 4 11 41 PM" src="https://github.com/user-attachments/assets/1c20e70d-f2d2-40e7-a494-20aa4e1c3d07" /> Before <img width="291" height="193" alt="Screenshot 2025-08-06 at 4 18 40 PM" src="https://github.com/user-attachments/assets/b5ccb244-ac92-4929-b589-e5d01eebfad6" /> After <img width="218" height="208" alt="Screenshot 2025-08-06 at 4 11 33 PM" src="https://github.com/user-attachments/assets/6b0049b0-6829-4599-82dd-5af001e94690" />
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { FieldType, MutableDataFrame, TIME_SERIES_TIME_FIELD_NAME } from '@grafana/data';
|
|
import { convertToWide } from './responseHandler';
|
|
|
|
describe('convertToWide', () => {
|
|
it('merge multiple SLI frames correctly', () => {
|
|
let frames = convertToWide([
|
|
new MutableDataFrame({
|
|
name: 'SLI',
|
|
refId: 'A',
|
|
fields: [
|
|
{ name: TIME_SERIES_TIME_FIELD_NAME, values: [1], type: FieldType.time },
|
|
{ name: TIME_SERIES_TIME_FIELD_NAME, values: [1.1], type: FieldType.number },
|
|
],
|
|
}),
|
|
new MutableDataFrame({
|
|
name: 'SLI',
|
|
refId: 'B',
|
|
fields: [
|
|
{ name: TIME_SERIES_TIME_FIELD_NAME, values: [1], type: FieldType.time },
|
|
{ name: TIME_SERIES_TIME_FIELD_NAME, values: [1.2], type: FieldType.number },
|
|
],
|
|
}),
|
|
]);
|
|
expect(frames.length).toStrictEqual(1);
|
|
expect(frames[0].fields.length).toStrictEqual(3);
|
|
expect(frames[0].fields[0].values.at(0)).toStrictEqual(1);
|
|
expect(frames[0].fields[1].values.at(0)).toStrictEqual(1.1);
|
|
expect(frames[0].fields[2].values.at(0)).toStrictEqual(1.2);
|
|
expect(frames[0].refId).toStrictEqual('A');
|
|
});
|
|
});
|