mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 19:00:09 -04:00
* getredash/redash#2629 Refactor Chart visualization, add option for handling NULL values (keep/convert to 0.0) * Handle null values in line/area stacking code; some cleanup * Handle edge case: line/area stacking when last value of one of series is missing * Mjnor update to line/area stacking code * Fix line/area normalize to percents feature * Unit tests * Refine tests; add tests for prepareLayout function * Tests for prepareData (heatmap) function * Tests for prepareData (pie) function * Tests for prepareData (bar, line, area) function * Tests for prepareData (scatter, bubble) function * Tests for prepareData (box) function * Remove unused file
65 lines
2.7 KiB
JavaScript
65 lines
2.7 KiB
JavaScript
/* eslint-disable global-require, import/no-unresolved */
|
|
import prepareLayout from './prepareLayout';
|
|
|
|
const fakeElement = { offsetWidth: 400, offsetHeight: 300 };
|
|
|
|
describe('Visualizations', () => {
|
|
describe('Chart', () => {
|
|
describe('prepareLayout', () => {
|
|
test('Pie', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/pie');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Pie without annotations', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/pie-without-annotations');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Pie with multiple series', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/pie-multiple-series');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Box with single Y axis', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/box-single-axis');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Box with second Y axis', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/box-with-second-axis');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Default with single Y axis', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/default-single-axis');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Default with second Y axis', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/default-with-second-axis');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Default without legend', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/default-without-legend');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
|
|
test('Default with stacking', () => {
|
|
const { input, output } = require('./fixtures/prepareLayout/default-with-stacking');
|
|
const layout = prepareLayout(fakeElement, input.options, input.series);
|
|
expect(layout).toEqual(output.layout);
|
|
});
|
|
});
|
|
});
|
|
});
|