Files
redash/client/app/visualizations/chart/plotly/prepareLayout.test.js
Arik Fraimovich 56d3be2248 Prettier all the Javascript code & GitHub Action (#4433)
* Prettier all the JS files

* Add GitHub Action to autoformat code pushed to master

* Fix eslint violation due to formatting.

* Remove GitHub actions for styling

* Add restyled.io config
2019-12-11 17:05:38 +02:00

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);
});
});
});
});