mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[agg_response/point_series] update tests to reflect changes in 19773a6
This commit is contained in:
parent
7460c0ac2d
commit
f681d6cf86
8 changed files with 15 additions and 90 deletions
|
@ -18,13 +18,15 @@ describe('getPoint', function () {
|
|||
describe('Without series aspect', function () {
|
||||
let seriesAspect;
|
||||
let xAspect;
|
||||
let yCol;
|
||||
let yAspect;
|
||||
let yScale;
|
||||
|
||||
beforeEach(function () {
|
||||
seriesAspect = null;
|
||||
xAspect = { i: 0 };
|
||||
yAspect = { i: 1 };
|
||||
yCol = { title: 'Y', aggConfig: {} };
|
||||
yAspect = { i: 1, col: yCol };
|
||||
yScale = 5;
|
||||
});
|
||||
|
||||
|
@ -37,8 +39,8 @@ describe('getPoint', function () {
|
|||
.to.have.property('x', 1)
|
||||
.and.have.property('y', 10)
|
||||
.and.have.property('z', 3)
|
||||
.and.have.property('aggConfigResult', row[1])
|
||||
.and.not.have.property('series');
|
||||
.and.have.property('series', yCol.title)
|
||||
.and.have.property('aggConfigResult', row[1]);
|
||||
});
|
||||
|
||||
it('ignores points with a y value of NaN', function () {
|
||||
|
|
|
@ -27,10 +27,11 @@ describe('getSeries', function () {
|
|||
[1, 2, 3]
|
||||
].map(wrapRows);
|
||||
|
||||
let yCol = { aggConfig: {}, title: 'y' };
|
||||
let chart = {
|
||||
aspects: {
|
||||
x: { i: 0 },
|
||||
y: { i: 1 },
|
||||
y: { i: 1, col: yCol },
|
||||
z: { i: 2 }
|
||||
}
|
||||
};
|
||||
|
@ -44,7 +45,7 @@ describe('getSeries', function () {
|
|||
let siri = series[0];
|
||||
expect(siri)
|
||||
.to.be.an('object')
|
||||
.and.have.property('label', '')
|
||||
.and.have.property('label', yCol.title)
|
||||
.and.have.property('values');
|
||||
|
||||
expect(siri.values)
|
||||
|
|
|
@ -57,7 +57,7 @@ describe('pointSeriesChartDataFromTable', function () {
|
|||
|
||||
let y = {
|
||||
agg: vis.aggs[0],
|
||||
col: { aggConfig: vis.aggs[0] },
|
||||
col: { aggConfig: vis.aggs[0], title: vis.aggs[0].makeLabel() },
|
||||
at: function (i) { return 100 * i; }
|
||||
};
|
||||
|
||||
|
@ -81,6 +81,7 @@ describe('pointSeriesChartDataFromTable', function () {
|
|||
expect(chartData.series).to.be.an('array');
|
||||
expect(chartData.series).to.have.length(1);
|
||||
let series = chartData.series[0];
|
||||
expect(series).to.have.property('label', y.col.title);
|
||||
expect(series.values).to.have.length(rowCount);
|
||||
series.values.forEach(function (point, i) {
|
||||
expect(point)
|
||||
|
@ -152,8 +153,7 @@ describe('pointSeriesChartDataFromTable', function () {
|
|||
|
||||
expect(point).to.have.property('y');
|
||||
expect(point.y).to.be.a('number');
|
||||
|
||||
expect(point).to.not.have.property('series');
|
||||
expect(point).to.have.property('series', siri.label);
|
||||
|
||||
expect(point).to.have.property('aggConfigResult');
|
||||
expect(point.aggConfigResult)
|
||||
|
|
|
@ -19,7 +19,6 @@ describe('Vislib AxisTitle Class Test Suite', function () {
|
|||
let yTitle;
|
||||
const data = {
|
||||
hits: 621,
|
||||
label: '',
|
||||
ordered: {
|
||||
date: true,
|
||||
interval: 30000,
|
||||
|
@ -28,6 +27,7 @@ describe('Vislib AxisTitle Class Test Suite', function () {
|
|||
},
|
||||
series: [
|
||||
{
|
||||
label: 'Count',
|
||||
values: [
|
||||
{
|
||||
x: 1408734060000,
|
||||
|
|
|
@ -17,7 +17,6 @@ describe('Vislib ChartTitle Class Test Suite', function () {
|
|||
let dataObj;
|
||||
const data = {
|
||||
hits: 621,
|
||||
label: '',
|
||||
ordered: {
|
||||
date: true,
|
||||
interval: 30000,
|
||||
|
@ -26,6 +25,7 @@ describe('Vislib ChartTitle Class Test Suite', function () {
|
|||
},
|
||||
series: [
|
||||
{
|
||||
label: 'Count',
|
||||
values: [
|
||||
{
|
||||
x: 1408734060000,
|
||||
|
|
|
@ -120,84 +120,6 @@ describe('Vislib Data Class Test Suite', function () {
|
|||
const rowIn = new Data(rowsData, {}, persistedState);
|
||||
expect(_.isObject(rowIn)).to.be(true);
|
||||
});
|
||||
|
||||
it('should update label in series data', function () {
|
||||
const seriesDataWithoutLabelInSeries = {
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
};
|
||||
const modifiedData = new Data(seriesDataWithoutLabelInSeries, {}, persistedState);
|
||||
expect(modifiedData.data.series[0].label).to.be('customLabel');
|
||||
});
|
||||
|
||||
it('should update label in row data', function () {
|
||||
const seriesDataWithoutLabelInRow = {
|
||||
'rows': [
|
||||
{
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
},
|
||||
{
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
const modifiedData = new Data(seriesDataWithoutLabelInRow, {}, persistedState);
|
||||
expect(modifiedData.data.rows[0].series[0].label).to.be('customLabel');
|
||||
expect(modifiedData.data.rows[1].series[0].label).to.be('customLabel');
|
||||
});
|
||||
|
||||
it('should update label in column data', function () {
|
||||
const seriesDataWithoutLabelInRow = {
|
||||
'columns': [
|
||||
{
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
},
|
||||
{
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
}
|
||||
],
|
||||
'yAxisLabel': 'customLabel'
|
||||
};
|
||||
|
||||
const modifiedData = new Data(seriesDataWithoutLabelInRow, {}, persistedState);
|
||||
expect(modifiedData.data.columns[0].series[0].label).to.be('customLabel');
|
||||
expect(modifiedData.data.columns[1].series[0].label).to.be('customLabel');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ describe('Vislib Column Layout Test Suite', function () {
|
|||
let el;
|
||||
const data = {
|
||||
hits: 621,
|
||||
label: '',
|
||||
ordered: {
|
||||
date: true,
|
||||
interval: 30000,
|
||||
|
@ -20,6 +19,7 @@ describe('Vislib Column Layout Test Suite', function () {
|
|||
},
|
||||
series: [
|
||||
{
|
||||
label: 'Count',
|
||||
values: [
|
||||
{
|
||||
x: 1408734060000,
|
||||
|
|
|
@ -18,7 +18,6 @@ describe('Vislib xAxis Class Test Suite', function () {
|
|||
let dataObj;
|
||||
const data = {
|
||||
hits: 621,
|
||||
label: '',
|
||||
ordered: {
|
||||
date: true,
|
||||
interval: 30000,
|
||||
|
@ -27,6 +26,7 @@ describe('Vislib xAxis Class Test Suite', function () {
|
|||
},
|
||||
series: [
|
||||
{
|
||||
label: 'Count',
|
||||
values: [
|
||||
{
|
||||
x: 1408734060000,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue