2021-09-08 07:04:27 -06:00
|
|
|
import { MutableDataFrame } from '@grafana/data';
|
2020-04-24 17:02:25 +02:00
|
|
|
|
2022-04-22 14:33:13 +01:00
|
|
|
import { traceFrameFields, zipkinResponse } from './testData';
|
|
|
|
|
import { transformResponse, transformToZipkin } from './transforms';
|
|
|
|
|
|
2020-04-24 17:02:25 +02:00
|
|
|
describe('transformResponse', () => {
|
|
|
|
|
it('transforms response', () => {
|
2021-03-10 17:45:03 +01:00
|
|
|
const dataFrame = transformResponse(zipkinResponse);
|
|
|
|
|
|
|
|
|
|
expect(dataFrame.fields).toMatchObject(traceFrameFields);
|
2020-04-24 17:02:25 +02:00
|
|
|
});
|
2021-09-08 07:04:27 -06:00
|
|
|
it('converts dataframe to ZipkinSpan[]', () => {
|
|
|
|
|
const dataFrame = transformResponse(zipkinResponse);
|
|
|
|
|
const response = transformToZipkin(new MutableDataFrame(dataFrame));
|
|
|
|
|
expect(response).toMatchObject(zipkinResponse);
|
|
|
|
|
});
|
2020-04-24 17:02:25 +02:00
|
|
|
});
|