|
@@ -106,7 +106,7 @@ describe('toDataFrame', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('SerisData backwards compatibility', () => {
|
|
describe('SerisData backwards compatibility', () => {
|
|
|
- it('converts TimeSeries to series and back again', () => {
|
|
|
|
|
|
|
+ it('can convert TimeSeries to series and back again', () => {
|
|
|
const timeseries = {
|
|
const timeseries = {
|
|
|
target: 'Field Name',
|
|
target: 'Field Name',
|
|
|
datapoints: [[100, 1], [200, 2]],
|
|
datapoints: [[100, 1], [200, 2]],
|
|
@@ -120,6 +120,17 @@ describe('SerisData backwards compatibility', () => {
|
|
|
expect(roundtrip.target).toBe(timeseries.target);
|
|
expect(roundtrip.target).toBe(timeseries.target);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ it('can convert empty table to DataFrame then back to legacy', () => {
|
|
|
|
|
+ const table = {
|
|
|
|
|
+ columns: [],
|
|
|
|
|
+ rows: [],
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const series = toDataFrame(table);
|
|
|
|
|
+ const roundtrip = toLegacyResponseData(series) as TableData;
|
|
|
|
|
+ expect(roundtrip.columns.length).toBe(0);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
it('converts TableData to series and back again', () => {
|
|
it('converts TableData to series and back again', () => {
|
|
|
const table = {
|
|
const table = {
|
|
|
columns: [{ text: 'a', unit: 'ms' }, { text: 'b', unit: 'zz' }, { text: 'c', unit: 'yy' }],
|
|
columns: [{ text: 'a', unit: 'ms' }, { text: 'b', unit: 'zz' }, { text: 'c', unit: 'yy' }],
|
|
@@ -135,7 +146,17 @@ describe('SerisData backwards compatibility', () => {
|
|
|
expect(roundtrip).toMatchObject(table);
|
|
expect(roundtrip).toMatchObject(table);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('converts DataFrame to TableData to series and back again', () => {
|
|
|
|
|
|
|
+ it('can convert empty TableData to DataFrame', () => {
|
|
|
|
|
+ const table = {
|
|
|
|
|
+ columns: [],
|
|
|
|
|
+ rows: [],
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const series = toDataFrame(table);
|
|
|
|
|
+ expect(series.fields.length).toBe(0);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('can convert DataFrame to TableData to series and back again', () => {
|
|
|
const json: DataFrameDTO = {
|
|
const json: DataFrameDTO = {
|
|
|
refId: 'Z',
|
|
refId: 'Z',
|
|
|
meta: {
|
|
meta: {
|