merge master

This commit is contained in:
ryan
2019-03-08 08:27:48 -08:00
parent 6617a382a3
commit 7ce7da1251
2 changed files with 14 additions and 6 deletions
@@ -2,14 +2,22 @@ import { toTableData } from './processTimeSeries';
describe('toTableData', () => {
it('converts timeseries to table skipping nulls', () => {
const input = {
const input1 = {
target: 'Field Name',
datapoints: [[100, 1], [200, 2]],
};
const data = toTableData([null, input, null, null]);
expect(data.length).toBe(1);
expect(data[0].columns[0].text).toBe(input.target);
expect(data[0].rows).toBe(input.datapoints);
const input2 = {
// without target
target: '',
datapoints: [[100, 1], [200, 2]],
};
const data = toTableData([null, input1, input2, null, null]);
expect(data.length).toBe(2);
expect(data[0].columns[0].text).toBe(input1.target);
expect(data[0].rows).toBe(input1.datapoints);
// Default name
expect(data[1].columns[0].text).toEqual('Value');
});
it('keeps tableData unchanged', () => {
@@ -209,7 +209,7 @@ export const toTableData = (results?: any[]): TableData[] => {
return {
columns: [
{
text: ts.target || 'Timeseries',
text: ts.target || 'Value',
unit: ts.unit,
},
{