Skip to content

Commit

Permalink
✅ Add tests for line point series with float values
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Jul 15, 2020
1 parent 6068285 commit a1c58e7
Show file tree
Hide file tree
Showing 3 changed files with 611 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import stackedSeries from '../../../fixtures/mock_data/date_histogram/_stacked_s
import { vislibPointSeriesTypes } from './point_series';
import percentileTestdata from './testdata_linechart_percentile.json';
import percentileTestdataResult from './testdata_linechart_percentile_result.json';
import percentileTestdataFloatValue from './testdata_linechart_percentile_float_value.json';
import percentileTestdataFloatValueResult from './testdata_linechart_percentile_float_value_result.json';

const maxBucketData = {
get: (prop) => {
Expand Down Expand Up @@ -215,18 +217,30 @@ describe('Point Series Config Type Class Test Suite', function () {
});

describe('line chart', function () {
beforeEach(function () {
function prepareData(percentileTestdata) {
const percentileDataObj = {
get: (prop) => {
return maxBucketData[prop] || maxBucketData.data[prop] || null;
},
getLabels: () => [],
data: percentileTestdata.data,
};
parsedConfig = vislibPointSeriesTypes.line(percentileTestdata.cfg, percentileDataObj);
});
return (parsedConfig = vislibPointSeriesTypes.line(
percentileTestdata.cfg,
percentileDataObj
));
}

it('should render a percentile line chart', function () {
const parsedConfig = prepareData(percentileTestdata);
expect(JSON.stringify(parsedConfig)).toEqual(JSON.stringify(percentileTestdataResult));
});

it('should render a percentile line chart when value is float', function () {
const parsedConfig = prepareData(percentileTestdataFloatValue);
expect(JSON.stringify(parsedConfig)).toEqual(
JSON.stringify(percentileTestdataFloatValueResult)
);
});
});
});
Loading

0 comments on commit a1c58e7

Please sign in to comment.