UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

46 lines 1.98 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } import * as plotters from "./index"; describe("plotters", function () { it("exports plotter factory functions", function () { expect(_typeof(plotters.makeLinePlotter)).toBe("function"); expect(_typeof(plotters.makeStackedBarPlotter)).toBe("function"); expect(_typeof(plotters.makeMultiColumnBarPlotter)).toBe("function"); expect(_typeof(plotters.makeHeatmapPlotter)).toBe("function"); expect(_typeof(plotters.makeAnomalyPlotter)).toBe("function"); expect(_typeof(plotters.makeAnnotationsPlotter)).toBe("function"); }); it("plotter factories return functions", function () { expect(_typeof(plotters.makeLinePlotter())).toBe("function"); expect(_typeof(plotters.makeStackedBarPlotter())).toBe("function"); expect(_typeof(plotters.makeMultiColumnBarPlotter())).toBe("function"); expect(_typeof(plotters.makeHeatmapPlotter())).toBe("function"); expect(_typeof(plotters.makeAnomalyPlotter())).toBe("function"); expect(_typeof(plotters.makeAnnotationsPlotter())).toBe("function"); }); it("stackedBar plotter handles mock data", function () { var mockPlotter = { drawingContext: { fillStyle: "", fillRect: function fillRect() {}, strokeRect: function strokeRect() {} }, points: [{ canvasx: 10, canvasy: 20 }, { canvasx: 30, canvasy: 40 }], dygraph: { toDomYCoord: function toDomYCoord() { return 100; } }, color: "#ff0000" }; var plotter = plotters.makeStackedBarPlotter(); expect(function () { return plotter(mockPlotter); }).not.toThrow(); }); });